#include <opencv2/opencv.hpp>

int main( int argc, char** argv )
{
    IplImage *im=cvLoadImage("edge.png");
    if (!im) return EXIT_FAILURE;

    CvSize imsize=cvGetSize(im);
    IplImage *gray=cvCreateImage(imsize,IPL_DEPTH_8U,1);
    IplImage *tmp=cvCreateImage(imsize,IPL_DEPTH_8U,1);
    IplImage *laplace=cvCreateImage(imsize,IPL_DEPTH_16S,1);

    cvCvtColor(im,gray,CV_BGR2GRAY);
    cvSmooth(gray,tmp,CV_BLUR,3,3,0,0);
    cvNot(tmp,gray);
    cvLaplace(gray,laplace,3);

    cvSaveImage("edge2.png",laplace);
    cvReleaseImage(&im);
    cvReleaseImage(&gray);
    cvReleaseImage(&tmp);
    cvReleaseImage(&laplace);


    return 0;
}
