图像腐蚀

图像腐蚀其实就是根据锚点来比较左边点,锚点本身,锚点上一个点的大小,取其小.

具体可以参考:http://blog.csdn.net/j3smile/article/details/7183119

下面给出一个使用实例:

char* srcimg = "fj.jpg";
 	char* smoothtitle = "SmmonthImg";
	
 	IplImage* psrcImg = cvLoadImage( srcimg );
	if( psrcImg == NULL ) return;

	IplImage* pdestImg = cvCreateImage( cvGetSize( psrcImg ),psrcImg->depth,psrcImg->nChannels );
	if( pdestImg == NULL ) return;
	
	cvNamedWindow( smoothtitle );
	cvShowImage( smoothtitle,psrcImg ); 
	int maskKernel[16] = {	1,0,1,1,
							2,3,4,1,
							1,0,0,1,
							2,0,3,0	};
	IplConvKernel *pKernel = cvCreateStructuringElementEx( 4,4,2,2,CV_SHAPE_CUSTOM,maskKernel );
	cvErode( psrcImg,pdestImg,pKernel );
	cvNamedWindow( "hsv",CV_WINDOW_AUTOSIZE );
	cvShowImage( "hsv",pdestImg );
	cvWaitKey( 0 );


你可能感兴趣的:(图像腐蚀)