标签:
(1)灰度直方图
imhist(I)
imhist(I, n) n灰度级数目 默认等于256
[counts, x]=imhist(...) counts为直方图的数据向量,counts(a)表示第a个区间像素数目,x保存了对应的小区间的向量,stem(x,counts/m/n)表示直方图概率。
(2)彩色图像直方图
i=imread(‘theatre.jpg‘);
[x,y,z]=size(i);
figure
subplot(221), imshow(i);
title(‘original image‘)
%提取红色分量
r=i;
%r(:,:,1)=a(:,:,1);
r(:,:,2)=zeros(x,y);
r(:,:,3)=zeros(x,y);
r=uint8(r);
subplot(222),imshow(r);
title(‘R-component-image‘)
%提取绿色分量
g=i;
g(:,:,1)=zeros(x,y);
%g(:,:,2)=a(:,:,2);
g(:,:,3)=zeros(x,y);
g=uint8(g);
subplot(223),imshow(g);
title(‘G-component-image‘)
%提取蓝色分量
b=i;
b(:,:,1)=zeros(x,y);
b(:,:,2)=zeros(x,y);
%b(:,:,3)=a(:,:,3);
b=uint8(b);
subplot(224),imshow(b);
title(‘B-component-image‘)
或者
i=imread(‘theatre.jpg‘);
r=a(:,:,1);
g=a(:,:,2);
b=a(:,:,3);
subplot(1,3,1), imhist(r), title(‘R component‘);
subplot(1,3,2), imhist(g), title(‘G component‘);
subplot(1,3,3), imhist(b), title(‘B component‘);
matlab 直方图
标签:
原文地址:http://www.cnblogs.com/h1359705211/p/4316912.html