首页 > 代码库 > 15.中值滤波器

15.中值滤波器

//中值滤波
int g_nMedianValue;
void on_ChangeMedianBlurValue(int,void*)
{
	if(g_nMedianValue>0 && g_nMedianValue%2==1)
	{
		medianBlur(g_srcImage_Contrast,g_dstImage_Contrast,g_nMedianValue);
		imshow("中值滤波",g_dstImage_Contrast);
	}
}
void Test_MedianBlur()
{
	namedWindow("中值滤波");
	namedWindow("原图");
	g_srcImage_Contrast=imread("D:\\OpenCV Projects\\OpenCV_Test_Image\\16.jpg");
	g_nMedianValue=http://www.mamicode.com/1;"trackbar","中值滤波",&g_nMedianValue,21,on_ChangeMedianBlurValue);
	on_ChangeMedianBlurValue(g_nMedianValue,0);
	imshow("原图",g_srcImage_Contrast);
}

技术分享

 

15.中值滤波器