图像处理篇-利⽤matlab绘制灰度直⽅图平台:windows7
软件:matlab 2014b
利⽤matlab绘制灰度直⽅图
figure;
I=imread('G:\matlab\img\1.jpg');
subplot(1,2,1);imshow(I);
title('原始图像');
imwrite(I,'test.png');
subplot(1,2,2);
imhist(y);
title('灰度图像直⽅图');
在利⽤imhist绘制直⽅图的时候,报错,如图
灰度直⽅图的绘制需要imhist函数,若直接imhist,由于图像是RGB格式,是3维的,是不能绘制的.
使⽤rgb2gray将图像转化为灰度图
figure;
I=imread('G:\matlab\img\1.jpg'); subplot(1,3,1);imshow(I);
title('原始图像');
imwrite(I,'test.png');
subplot(1,3,2);
y=rgb2gray(I);
imshow(y);
title('灰度图');
subplot(1,3,3);
imhist(y);
matlab直方图title('灰度图像直⽅图');
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论