MATLAB: Help for ‘imread’

image processingimread

Hi dear, Can someone help me telling me what this means?
img = imread('imgs/lego.png');
blue = img(:,:,1);
What return in 'blue'?

Best Answer

If imgs/lego.png is an RGB color image, then "blue" will hold the red channel information. If imgs/lego.png is a grayscale image, then "blue" will hold the brightness information. If imgs/lego.png is an indexed (pseudocolor) image, then "blue" will hold the index information but there will be no information available about what color each distinct index is to correspond to.
The first pane, (:,:,1) of an RGB image is the Red information. The second pane, (:,:,2) is the Green information. The third pane, (:,:,3) is the Blue information.