数字图像处理实验报告 下载本文

内容发布更新时间 : 2024/6/9 15:55:46星期一 下面是文章的全部内容请认真阅读。

.

test5原图test5幅度谱图test5低通滤波图test5高通滤波图

由滤波结果可以得出,低通滤波器由于滤掉了高频成分,高频成分含有大量边缘信息,所以造成了一定程度的图像模糊。高通滤波器滤掉了低频成分,保留了高频成分,即保留了边界信息,所以显示出原图像的边界。

Word 资料

.

附录 实验代码

实验一

1.图像灰度线性变换的实现

%①fa=100;fb=150;ga=50;gb=200; I=imread('d:\\test1.jpg','jpg'); subplot(1,2,1); imshow(I);

title('test1原始图像'); subplot(1,2,2); imhist(I);

title('test1灰度直方图'); fa=100; fb=150; ga=50; gb=200; a=ga/fa;

b=(gb-ga)/(fb-fa); c=(255-gb)/(255-fb); [M,N]=size(I); for i=1:M

Word 资料

.

for j=1:N if I(i,j)<=fa I(i,j)=a*I(i,j); else if I(i,j)<=fb

I(i,j)=b*(I(i,j)-fa)+ga; else I(i,j)=c*(I(i,j)-fb)+gb; end end end end figure

subplot(1,2,1); imshow(I); title('test1变换后'); subplot(1,2,2); imhist(I);

title('test1变换后灰度直方图');

%改变灰度变换的范围fa=30;fb=50;ga=30;gb=200;

I=imread('d:\\test1.jpg','jpg'); subplot(1,2,1);

Word 资料

.

imshow(I);

title('test1原始图像'); subplot(1,2,2); imhist(I);

title('test1灰度直方图'); fa=30; fb=50; ga=30; gb=200; a=ga/fa;

b=(gb-ga)/(fb-fa); c=(255-gb)/(255-fb); [M,N]=size(I); for i=1:M for j=1:N if I(i,j)<=fa I(i,j)=a*I(i,j); else if I(i,j)<=fb

I(i,j)=b*(I(i,j)-fa)+ga; else I(i,j)=c*(I(i,j)-fb)+gb; end end

Word 资料

.

end end figure

subplot(1,2,1); imshow(I); title('test1变换后'); subplot(1,2,2); imhist(I);

title('test1变换后灰度直方图'); 2.图像的均衡化处理

I=imread('d:\\test2.jpg','jpg'); subplot(1,2,1); imshow(I);

title('test2原始图像'); subplot(1,2,2); imhist(I);

title('test2灰度直方图'); G=histeq(I); figure

subplot(1,2,1); imshow(G);

title('test2均衡化图像');

Word 资料