17.腐蚀
Posted foggia2004
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了17.腐蚀相关的知识,希望对你有一定的参考价值。
//腐蚀 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.腐蚀的主要内容,如果未能解决你的问题,请参考以下文章