#include <cv.h> #include <highgui.h> #include <iostream> using namespace std; int main( int argc, char **argv) { IplImage *imgA = cvLoadImage( "lena.jpg", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR); if(imgA ==NULL) { cout<<"Can't Load Image ." << endl; return -1; } IplImage *tmp = cvCloneImage(imgA); cvMorphologyEx(imgA, imgA, tmp, NULL, CV_MOP_GRADIENT, 1); cvNamedWindow("window",CV_WINDOW_AUTOSIZE); cvShowImage("window",imgA); cvWaitKey(0); cvSaveImage("image.jpg",imgA); cvReleaseImage( &imgA ); cvDestroyWindow("window"); return 0; }
本文转自gnuhpc博客园博客,原文链接:http://www.cnblogs.com/gnuhpc/archive/2012/10/13/2722920.html,如需转载请自行联系原作者