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!
Best Answer