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


本文转自gnuhpc博客园博客,原文链接:http://www.cnblogs.com/gnuhpc/archive/2012/11/25/2787619.html,如需转载请自行联系原作者
上一篇:JavaScript程序设计之HTML文档基础


下一篇:struts2 漏洞分析与防护方案 CVE-2017-5638 S2-045 除了升级外还是有修复方案的