My work is in image processing. My objective is to calculate RGB values of a gray level image. By data cursor tool I can see those values but when I am trying to retrieve those values through the program they are completely different. Like in Data cursor toll values are near 0.017, 0.07, 0.06 etc.. but through the program, they are different (in between 0 and 1).
Commands:-
RGBpixels=impixel(I2,col,row);
a=mat2gray(RGBpixels)