MATLAB: Converting intensity image (RGB) into a 2-d array of numbers (2D)

data from imagergb to intensity

I am given a saved figure in matlab.First I want to obtain data from this figure. the data is like 3-D (x,y,intensity or power).I can see the colorbar beside the image.It is shown like an intensity or heatmap image (x,y,RGB).I think it uses jet colormap.The color of the image is ranged from blue (for low power) to red (for high power) .So RGB is NOT representative . I need one number instead of RGB, in the other word I need (x,y,'intenstity') which 'intensity' should be calculated from RGB in a correct way. So I need the inverse of the transformation that matlab use to show an intensity image from a 2-D matrice

Best Answer

The attached code worked well!
Related Question