What is the relation between non-integer index and RGB values?
Mostrar comentarios más antiguos
I am trying to access the RGB values in int16 indexed images that are contained in a .mat file. For example, > load('brain.mat') I then obtain a 'brainImg' variable which is a cell
The images are contained in this cell, such that img = brainImg{1,1};
I can view the image (with imshow(img,[])) and with the data tip cursor, I see, for example: X = 103, Y=35, Index=265 and the R, G, B values, which are all equal to 0.247 (gray image).
I understand 265 is the row in the colormap to which that RGB value corresponds.
When doing > img2 = im2double(img) > imshow(img2,[])
and point with the data cursor to the same point (X=103,Y=35), I see that while the RGB values are the same, the index has changed and is now Index=0.5041
In fact, the new indices are from 0.50.. to 0.51...
What does this non-integer index represent?
Can I somehow access the RGB values directly? (I tried [a, map] = imread(...) but that didn't work in my case because my images are embedded in the .mat file -- Do I need to manually extract them, save them and then read them with 'imread').
I've searched and tried many things; any insight on these questions is much appreciated!!
Thank you!
1 comentario
Surabhi k-sreenivas
el 28 de Abr. de 2021
While using imshow the Index value and the pixel value are different. I believe that the Index value is basically recalled from the map which is not accessible in the case of uint16. Thus using the intensity or pixel values i.e. in the 2D matrix should give you the intensity.
In the case of a monochannel camera, images have the same R,G,B values.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Basic Display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!