1 实验题目
给出多幅图像的直方图并计算该图像信息熵、标准差和平均梯度,并进行分析(注 意图像的选择和设计)。
2 程序源代码
clc;
A1=imread('b.jpg');
subplot(4,4,1);imshow(A1);title('原图');
Ar=A1(:,:,1);%R 通道
Ag=A1(:,:,2);%G 通道
Ab=A1(:,:,3);%B 通道
subplot(4,4,4),imshow(A1(:,:,1));title('红色分量图'); %R 通道
subplot(4,4,7),imshow(A1(:,:,2));title('绿色分量图'); %G 通道
subplot(4,4,10),imshow(A1(:,:,3));title('蓝色分量图'); %B 通道
subplot(4,4,5),imhist(Ar);title('红色分量直方图');
subplot(4,4,8),imhist(Ag);title('绿色分量直方图');
subplot(4,4,11),imhist(Ab);title('蓝色分量直方图');
subplot(4,4,6),imhist(Ar,10);title('红色指定灰度级');
subplot(4,4,9),imhist(Ag,25);title('绿色指定灰度级');
subplot(4,4,12),imhist(Ab,50);title('蓝色指定灰度级');
if length(size(A1))>2%size 获得矩阵的大小,length 获得矩阵最大维度
A1=rgb2gray(A1);
end
subplot(4,4,2);imshow(A1);title('原图灰度化');
subplot(4,4,3);imhist(A1);title('原直方图');
ima=imadjust(A1);%按默认参数进行对比度调整
his=histeq(A1);%按默认参数对直方图进行均衡化
subplot(4,4,13);imshow(ima);title('对比度默认拉伸图');
subplot(4,4,14);i

最低0.47元/天 解锁文章
1220

被折叠的 条评论
为什么被折叠?



