OpenCV学习——形态学梯度

#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;
}

你可能感兴趣的:(opencv)