计算机视觉
图像处理

opencv实现图像邻域滤波

均值滤波、中值滤波、高斯滤波

void CCVMFCView::OnBlurSmooth()//邻域均值滤波
{
	IplImage* in;
	in = workImg;
	IplImage* out = cvCreateImage(cvGetSize(in),IPL_DEPTH_8U,workImg->nChannels); 
	cvSmooth(in,out,CV_BLUR,3,workImg->nChannels);  //  简单平均
	m_dibFlag=imageReplace(out,&workImg); 

	Invalidate();
}
void CCVMFCView::OnMedianSmooth()
{
	IplImage* in = workImg;
	IplImage* out = cvCreateImage(cvGetSize(in),
		IPL_DEPTH_8U,workImg->nChannels); 
	cvSmooth(in,out,CV_MEDIAN,3,workImg->nChannels);  //  中值滤波
	m_dibFlag=imageReplace(out,&workImg);

	Invalidate();
}
void CCVMFCView::OnGaussSmooth()
{
	IplImage* in = workImg;
	IplImage* out = cvCreateImage(cvGetSize(in),IPL_DEPTH_8U,workImg->nChannels);   //  建立辅助位图
	cvSmooth(in,out,CV_GAUSSIAN,3,workImg->nChannels);  //  Gauss 平滑
	m_dibFlag=imageReplace(out,&workImg);   //  输出处理结果
	Invalidate();
}

转载注明来源:CV视觉网 » opencv实现图像邻域滤波

分享到:更多 ()
扫描二维码,给作者 打赏
pay_weixinpay_weixin

请选择你看完该文章的感受:

0不错 0超赞 0无聊 0扯淡 0不解 0路过

评论 4

评论前必须登录!