Rgb2ind value coding problem
Mostrar comentarios más antiguos
Hello all. I have some question. i have an image, i read the image using imread after that i convert it to index image using rgb2ind. Then i save it into text file(.txt). why the value in the text file only 0 and 1 ? does it supposed to show range of value from 0-255 ?
a = imread('img1.jpg');
[b,map]=rgb2ind(x,32);
prewitts=edge(b,'prewitt');
dlmwrite('test1.txt', prewitts, 'delimiter', ',');
im using this code. also attach the image and the text file.
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 28 de Nov. de 2014
If, for some reason, you want 0 and 255, you could just multiply by 255:
prewitts = uint8(255 * edge(b,'prewitt'));
2 comentarios
Akmal Rahmat
el 30 de Nov. de 2014
Editada: Akmal Rahmat
el 30 de Nov. de 2014
Image Analyst
el 30 de Nov. de 2014
You're right that 1, multiplied by 255, will show up as 255 in the text file. But what value do you want the zero to show up as in your text file?
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!