|
Mathew Thomas:
Either I don't understand you, or you don't understand me. Let's say you have an array called imageArray, which is a monochrome (gray scale) image with 256 gray levels in the range of 0-255. If you have a colormap (256 by 3) and you look at row (index) 42, and it is [0 1 0] and you then display the imageArray with a colormap, then every pixel in the image that has gray level 41 will show up as green. Same for all the other gray levels in the image - each gets displayed with the color that is indicated by it's gray level, which (after you add 1 to it) is an index into the pseudo color look up table. If you really want the "index" as a separate variable, then just try this:
grayValue= imageArray(123, 319);
index = grayValue + 1; % because arrays are 1 based while gray scale is zero based.
This will give you the "index" for the pixel at (row, column) = (123, 319). Let's say that index = 42 (meaning that imageArray(123, 3199) equals 41). Then you look at row 42, and read off the 3 normalized (must be in the range 0-1) values of colormap in row 42 that correspond to the color that all pixels of value 41 will be displayed with if you use the colormap.
I have no idea what you mean by "But is there any way I can access this numbers from the code instead of the image." The image is a variable, and you can get values from variables by writing code, like I showed above. So I really don't understand the difference that you think exists between "the image" and "the code."
|