码迷,mamicode.com
首页 > 其他好文 > 详细

17.腐蚀

时间:2017-03-21 22:30:46      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:log   png   http   处理   dev   struct   imshow   csharp   pen   

//腐蚀
int g_nErodeValue;
int g_nErodeType;
Mat g_mElement;
//这2个消息处理函数可以合并为1个
void on_ChangeErodeValue(int,void*)
{
	if(g_nErodeValue>0)
	{
		g_mElement=getStructuringElement(g_nErodeType,Size(g_nErodeValue,g_nErodeValue));
		erode(g_srcImage_Contrast,g_dstImage_Contrast,g_mElement);
		imshow("腐蚀滤波",g_dstImage_Contrast);
	}
}
void on_ChangeErodeType(int,void*)
{

	g_mElement=getStructuringElement(g_nErodeType,Size(g_nErodeValue,g_nErodeValue));
	erode(g_srcImage_Contrast,g_dstImage_Contrast,g_mElement);
	imshow("腐蚀滤波",g_dstImage_Contrast);

}
void Test_ErodeBlur()
{
	namedWindow("腐蚀滤波");
	namedWindow("原图");
	g_srcImage_Contrast=imread("D:\\OpenCV Projects\\OpenCV_Test_Image\\16.jpg");
	g_nErodeValue=1;
	g_nErodeType=0;
	createTrackbar("erode_value","腐蚀滤波",&g_nErodeValue,30,on_ChangeErodeValue);
	createTrackbar("erode_type","腐蚀滤波",&g_nErodeType,2,on_ChangeErodeType);
	on_ChangeErodeValue(g_nErodeValue,0);
	on_ChangeErodeType(g_nErodeValue,0);
	imshow("原图",g_srcImage_Contrast);
}

技术分享

 

17.腐蚀

标签:log   png   http   处理   dev   struct   imshow   csharp   pen   

原文地址:http://www.cnblogs.com/foggia2004/p/6596812.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!