资源描述:
《opencv图像平滑处理》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《OpenCV图像处理》---上机实验报告3otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryoft
2、helongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand图像的平滑处理一、实验名称:图像的平滑处理二、实验目的:1、了解OpenCV中图像的处理功能;2、使
3、用OpenCV对图像进行平滑处理。三、实验内容:1、了解归一化块滤波器、高斯滤波器、中值滤波器和双边滤波器基本理论;2、使用四种线性滤波器对图像进行平滑处理。四、实验原理:载入一张原图像,分别使用归一化块滤波器、高斯滤波器、中值滤波器和双边滤波器对图像进行平滑处理,运行程序显示平滑图像。平滑也称模糊,是一项简单且使用频率很高的的图像处理方法;平滑处理时需要用到一个滤波器,最常用的滤波器是线性滤波器,线性滤波处理的输出像素值(i.e.g(i,j))是输入像素值(i.e.f(i+k,j+l))的加权和:h(k,l
4、)称为核,它仅仅是一个加权系数。五、实验运行环境:Windows7操作系统,MicrosoftVisualC++2008ExpressEdition六、实验源代码:#include#include#include#includeusingnamespacestd;usingnamespacecv;intDELAY_CAPTION=1500;intDELAY
5、_BLUR=100;intMAX_KERNEL_LENGTH=31;Matsrc;Matdst;charwindow_name[]="FilterDemo1";intdisplay_caption(char*caption);intdisplay_dst(intdelay);intmain(intargc,char**argv){namedWindow(window_name,CV_WINDOW_AUTOSIZE);otherstaffoftheCentre.Duringthewar,Zhuwastransf
6、erredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterpri
7、sesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersandsrc=imread("li.jpg",1);if(display_caption("OriginalImage")!=0){return0;}dst=src.clone();if(display_dst(DELAY_CAPTION)!=
8、0){return0;}if(display_caption("HomogeneousBlur")!=0){return0;}for(inti=1;i