ImageVerifierCode 换一换
格式:DOCX , 页数:30 ,大小:853.45KB ,
资源ID:678296      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-678296.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(东北大学计算机图像处理实验报告.docx)为本站会员(b****2)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

东北大学计算机图像处理实验报告.docx

1、东北大学计算机图像处理实验报告计算机图像处理实验报告 学院:信息学院班级:电子信息工程姓名:学号:实验内容:数字图像处理1、应用MATLAB语言编写显示一幅灰度图像、二值图像、索引图像及彩色图像的程序,并进行相互之间的转换;(1)、显示一副真彩RGB图像代码:I=imread(cartoon.jpg); %读取彩色图像imshow(I);效果:(2)、RGB转灰度图像代码:graycartoon=rgb2gray(I); %彩色图像转换为灰度图像 subplot(1,2,1); subimage(I); subplot(1,2,2); subimage(graycartoon);效果:(3)、

2、RGB转索引图像代码:indcartoon,map=rgb2ind(I,0.7); %彩色图像转换为索引图像 subplot(1,2,1); subimage(I); subplot(1,2,2); subimage(indcartoon,map);效果:(4)、索引图像转RGB代码:I1=ind2rgb(indcartoon,map); %索引图像转换为彩色图像subplot(1,2,1);subimage(indcartoon,map);subplot(1,2,2);subimage(I1);效果:(5)、索引转灰度图像代码:i2gcartoon=ind2gray(indcartoon,m

3、ap); %索引图像转换为灰度图像subplot(1,2,1);subimage(indcartoon,map);subplot(1,2,2);subimage(i2gcartoon);效果:(6)、灰度转索引图像代码:g2icartoon,map=gray2ind(graycartoon,64); %灰度转索引图像subplot(1,2,1);subimage(graycartoon);subplot(1,2,2);subimage(g2icartoon,map);效果:(7)、RGB转二值图像代码:r2bwcartoon=im2bw(I,0.5);subplot(1,2,1);subima

4、ge(I);subplot(1,2,2);subimage(r2bwcartoon);效果:(8)灰度转二值图像代码:g2bwcartoon=im2bw(graycartoon,0.5);subplot(1,2,1);subimage(graycartoon);subplot(1,2,2);subimage(g2bwcartoon);效果:(9)、索引转二值图像代码:indcartoon,map=rgb2ind(I,0.7); subplot(1,2,1); subimage(I); subplot(1,2,2); subimage(indcartoon,map); i2bwcartoon=i

5、m2bw(indcartoon,map,0.7);subplot(1,2,1);subimage(indcartoon,map);subplot(1,2,2);subimage(i2bwcartoon);效果:2、应用MATLAB工具箱演示一幅图像的傅里叶变换、离散余弦变换,观察其频谱图。然后将它们进行逆变换,观察逆变换后的图像;(1)傅里叶正变换代码:F=fft2(graycartoon);subplot(1,2,1);subimage(graycartoon);subplot(1,2,2);subimage(log(abs(F),3,10);效果:(2)傅里叶反变换代码:IF=ifft2(

6、F);subplot(1,2,1);subimage(log(abs(F),3,10);subplot(1,2,2);subimage(uint8(IF);效果:(3)DCT变换代码:B=dct2(graycartoon);subplot(1,2,1);subimage(graycartoon);subplot(1,2,2);subimage(log(abs(B),3,5);效果:(4)iDCT变换代码:iB=idct2(B);subplot(1,2,1);subimage(log(abs(B),3,5);subplot(1,2,2);subimage(uint8(iB);效果:3.应用MAT

7、LAB语言编程来实现一幅图像的增强。(1)取一幅灰度图像,对其进行线性点运算,即(,)分别取(1.5,1.2)、(0.7,1.2),分析变化后图像,并分析直方图。代码:graycartoon=double(graycartoon); graycartoon1=1.5*graycartoon+1.2;subplot(2,2,1);subimage(uint8(graycartoon);subplot(2,2,2);imhist(uint8(graycartoon);subplot(2,2,3);subimage(uint8(graycartoon1);subplot(2,2,4);imhist(

8、uint8(graycartoon1);效果:代码2:graycartoon=double(graycartoon); graycartoon1=0.7*graycartoon+1.2;subplot(2,2,1);subimage(uint8(graycartoon);subplot(2,2,2);imhist(uint8(graycartoon);subplot(2,2,3);subimage(uint8(graycartoon1);subplot(2,2,4);imhist(uint8(graycartoon1);效果:分析:a=0.7的时候由于图像对比度的下降所以导致灰度值范围的减小;

9、a=1.5的时候图像对比度增大,故使输出的灰度值范围增大。(2)取一幅灰度图像,对其进行直方图均衡化处理,再对其进行规定化处理,并对结果进行分析。代码:graycartoon=uint8(graycartoon);eqcartoon=histeq(graycartoon);subplot(2,2,1);subimage(graycartoon);subplot(2,2,2);imhist(graycartoon);subplot(2,2,3);subimage(eqcartoon);subplot(2,2,4);imhist(eqcartoon);效果:规定化代码:hgram=50:2:250

10、;speciacartoon=histeq(graycartoon,hgram); subplot(2,2,1);subimage(graycartoon); subplot(2,2,2); imhist(graycartoon); subplot(2,2,3); subimage(speciacartoon); subplot(2,2,4); imhist(speciacartoon);效果:分析: 直方图规定化的优点是能够自动增强整个图像的对比度,缺点是它的具体增强效果不容易控制处理的结果是得到的全局的均衡化直方图。相比这些图像均衡化就有其优势所在:图像均衡化是把一个已知灰度概率密度分布的

11、图像经过某种变化,使其成为一个具有均匀灰度概率密度的分布新图像。其结果的扩展了像元取值的动态范围,从而达到了增强图像整体的对比度。思考题:如果将一幅图像进行一次直方图均衡化处理后,再进行一次直方图均衡化处理,结果会发生变化吗?观察两次均衡化的直方图是否一样。答:代码:A=imread(cartoon.jpg); B=rgb2gray(A); I=histeq(B); %第一次均衡化 I1=histeq(I); %第二次均衡化 subplot(121); imshow(I1); subplot(122); imhist(I1)通过实验分析两次均衡化的直方图一样,不会发生变化,(3)取一幅灰度图像

12、,加入噪声后对其进行平滑滤波(均值滤波、中值滤波),并观察不同滤波方式下的效果。代码:noisecartoon=imnoise(graycartoon,salt & pepper); avecartoon=filter2(fspecial(average,3),noisecartoon)/255;medcartoon=medfilt2(noisecartoon,3,3); subplot(2,2,1);subimage(graycartoon);title(原图); subplot(2,2,2);subimage(noisecartoon);title(加噪声图); subplot(2,2,3

13、);subimage(avecartoon);title(均值平滑图); subplot(2,2,4);subimage(medcartoon);title(中值滤波图);效果:分析: 中值滤波是一种非线性滤波所以可以克服线型滤波器所带来的图像细节模糊问题,对滤波脉冲干扰及颗粒噪声效果最好。均值滤波的效果与所使用领域半径的大小有关,半径越大像素点越多,则信噪比提高的越大,平滑效果越好,缺点是平滑图像的模糊程度越大。(4)取一幅灰度图像,采用不同的算子对其进行边缘锐化,并分析结果。代码:sobelcartoon=filter2(fspecial(sobel),graycartoon);prewi

14、ttcartoon=filter2(fspecial(prewitt),graycartoon);laplaciancartoon=filter2(fspecial(laplacian),graycartoon);subplot(2,2,1);subimage(graycartoon);title(原图);subplot(2,2,2);subimage(sobelcartoon);title(sobel警察);subplot(2,2,3);subimage(prewittcartoon);title(prewitt警察);subplot(2,2,4);subimage(laplaciancar

15、toon);title(laplacian警察);效果:分析: Prewitt算子:一种一阶微分算子的边缘检测,利用像素点上下,左右邻点的灰度差,在边缘处达到极值检测边缘,去掉部分伪边缘,对噪声具有平滑作用。sobel算子:对称的一阶差分,对中心加权具有一定的平滑作用。Laplacian算子:二次微分算子,满足不同走向的图像边缘锐化要求,对噪声的增强作用较弱,一半用它进行边缘增强时,有必要将图像先进行平滑处理。思考题:为了达到边缘锐化的反差增强效果,实际应用中将高频增强和直方图均衡化结合起来使用,这两个操作的次序能互换吗?效果一样吗?I=imread(cartoon.jpg); I=rgb2g

16、ray(I); subplot(241),imshow(I);title(原始图像); I1=0,-1,0;-1,5,-1;0,-1,0; I3=imfilter(I,I1); subplot(242),imshow(uint8(I3);title(拉普拉斯算子锐化图像); h=ones(size(I3); f1,f2=freqspace(size(I3),meshgrid); r=sqrt(f1.2+f2.2); h(r0.3)=0; Y=fft2(double(I3); Y=fftshift(Y); y=Y.*h; y=ifftshift(y); I4=ifft2(y); subplot(

17、243),imshow(uint8(I4);title(高频增强图像); I5=histeq(I4); subplot(244),imshow(I5);title(均衡化图像); P=imread(cartoon.jpg); P=rgb2gray(P); subplot(245),imshow(P),title(原始图像); ii=0,-1,0;-1,5,-1;0,-1,0; P1=imfilter(P,I1); subplot(246),imshow(uint8(P1);title(拉普拉斯算子锐化图像); P2=histeq(P1); subplot(248),imshow(P2);tit

18、le(均衡化图像); J=ones(size(P2); f3,f4=freqspace(size(P2),meshgrid); r1=sqrt(f3.2+f4.2); J(r1blurcartoon=imfilter(graycartoon,PSF,circular,conv); subplot(1,2,1);subimage(graycartoon);title(原图); subplot(1,2,2);subimage(blurcartoon);title(运动糊化的图);效果:逆滤波代码:noise=0.1*randn(size(graycartoon);blurnoicartoon=im

19、add(blurcartoon,im2uint8(noise);subplot(1,3,3);subimage(blurnoicartoon);wnr1cartoon=deconvwnr(blurcartoon,PSF);%逆滤波wnr1cartoon1=deconvwnr(blurnoicartoon,PSF);%逆滤波figure(2);subplot(1,2,2);subimage(wnr1cartoon);subplot(1,2,1);subimage(wnr1cartoon1);效果:维纳滤波代码:noise=0.1*randn(size(graycartoon);blurnoica

20、rtoon=imadd(blurcartoon,im2uint8(noise); wnr2cartoon=deconvwnr(blurnoicartoon,PSF); NSR=sum(noise(:).2)/sum(im2double(graycartoon(:).2); wnr3cartoon=deconvwnr(blurnoicartoon,PSF,NSR); subplot(1,3,1);subimage(blurnoicartoon);title(运动加噪声警察); subplot(1,3,2);subimage(wnr2cartoon);title(维纳滤波警察); subplot(

21、1,3,3);subimage(wnr3cartoon);title(真实信噪比维纳恢复警察);效果:5、应用MATLAB语言编写实现一幅图像的旋转、剪切和缩放;旋转代码:rotatcartoon=imrotate(graycartoon,45,nearest); rotatcartoon1=imrotate(graycartoon,45,bilinear); rotatcartoon2=imrotate(graycartoon,45,bicubic);subplot(2,2,1);subimage(graycartoon);title(原警察);subplot(2,2,2);subimage

22、(rotatcartoon);title(最邻域旋转警察); subplot(2,2,3);subimage(rotatcartoon1);title(双线性旋转警察); subplot(2,2,4);subimage(rotatcartoon2);title(双立方旋转警察);效果:剪切代码:imshow(graycartoon);cropcartoon=imcrop(graycartoon,100,100,200,200); subplot(1,2,1);imshow(graycartoon);title(警察叔叔); subplot(1,2,2);imshow(cropcartoon);

23、title(剪切警察);效果:缩放代码:minimizecartoon=imresize(graycartoon,0.2,nearest);magnifycartoon=imresize(minimizecartoon,3,bilinear);imshow(minimizecartoon);imshow(magnifycartoon);效果:6、应用MATLAB语言编程来实现一幅图像的边缘检测。 代码:cartoonedge=edge(graycartoon,canny);subplot(1,2,1);subimage(graycartoon);subplot(1,2,2);subimage(cartoonedge);imshow(cartoonedge);效果:实验感悟:这次实验,我的收获很大。虽说数字图像处理学了这么久,但是开始编程读取图像和图像直方图对我来说还是比较生疏的,不过通过实验对MatLab软件的使用有了基本的了解,学会了使用MatLab软件来读取一个特定格式的图像,并通过相关的命令语句对图像进行格式转换、图像压缩、二值化等的处理,掌握了利用MATLAB来获取图像的大小、颜色、高度、宽度等等相关信息,掌握在MATLAB中如何通过imshow()语句来读取图像等等。对图像的四则运算了结图像的不同变化过程,对软件的进一步使用也有了更加深刻的认识。

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2