I am Not able To sort Out How to achieve This.

OK I am a beginner. I have written a code for changing rgb values of a image by inputting ASCII value from a text file. I only changed row 1 for now. What i need to do is that I want to create another text file and store the original text in it using ASCII value in row 1 of newly created image

 Respuesta aceptada

Thorsten
Thorsten el 19 de Nov. de 2014
Editada: Thorsten el 19 de Nov. de 2014
You could simplify your code
I = rgb2gray(imread('peppers.png'));
T = 'Hallo World';
I(1,1:length(T)) = uint8(T);
To get the text back from the image you need to know the length of the text. Than you can retrieve it using
T2 = char(I(1,1:length(T))
and write it to a file with fwrite.

1 comentario

Thorsten
Thorsten el 19 de Nov. de 2014
Editada: Thorsten el 19 de Nov. de 2014
Please look at the second part of my answer where I tried to address how to recover the ASCII values from the image. Note that there is no way to distinguish an ASCII value in the image from an gray value. In the image, it's all a number (a uint8) between 0 and 255, so you need the position in the image where the text has been stored.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Preguntada:

el 19 de Nov. de 2014

Editada:

el 19 de Nov. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by