MATLAB - 有人可以解释一下这些代码行的作用

时间:2014-04-21 01:14:24

标签: matlab

嗨,有人可以帮我解决这个问题,我知道它会读取图像并在直方图上显示RGB图像的红色通道(Fruits1)。

colourImage = imread('Fruits1.jpg');        //read image  
redHistogram = double(colourImage(:,:,1));  //what does this line do?  
figure, hist(redHistogram(:),124);          //what does this line do?

1 个答案:

答案 0 :(得分:1)

redHistogram = double(colourImage(:,:,1));  //what does this line do?

这将获取图像的红色平面,并将每个像素强度从整数(0-255)转换为浮点值(double)。结果是这些值的二维数组。

figure, hist(redHistogram(:),124);          //what does this line do?

这将显示上面像素强度的直方图,分为124个相等大小的区域。