How can I draw/plot intensity of image in 2D figure in MATLAB

I have a example about drawing image intensity of image in 2D figure. The y-axis is very clear which is intensity of pixel in the image. However, I am confusing about x-axis, which is pixel index or something? Could you see the figure below and let predict what is x-axis? How can I plot the figure look like that in MATLAB? Thanks

In my knowledge, if x-axis is pixel index then I plot as

I=Img(:);
plot(1:length(I),I);

在这里输入图像描述


Your image is a 2D array that contains, in every element, the pixel intensity.

If you check the image size by size(img) , or if you count the pixels of one row or column of the image on the left, you'll notice that the image is an array of 130x130 pixels.

Consequently, the plots on the right show the intensity profile along one row or column of your image, for example row #100.

To plot row #100, you would write:

plot(img(100,:)) %//Matlab will automatically put x as 1:size(img,2)

To create the figure (top row), you would write

figure
subplot(1,2,1)
imshow(img,[]);
subplot(1,2,2)
plot(img(100,:)
链接地址: http://www.djcxy.com/p/89776.html

上一篇: 强度等级的映射以创建平坦的直方图

下一篇: 如何在MATLAB中绘制/绘制2D图形中的图像强度