Ask Your Question
0

getting error using canny edge detector

asked 2013-12-10 03:41:26 -0600

ati gravatar image

I do not know why I get error in this line:

Canny( dst_Gaussian, dst_Gaussian, 100, 100*3, 3 );

everything seems correct but I get "Unhandled exception.." error.

This is what I am trying to do:

    cv::Mat dis = Mat(width, height, CV_32FC1, dises);
    cv::Mat dst_Gaussian(width, height, CV_32FC1);
    Mat dst_Canny;
    dst_Gaussian= dis.clone();
    dst_Canny.create( dis.size(), dis.type() );

//  

blur( dis, dis, Size(3,3));

    GaussianBlur( dis, dst_Gaussian, Size( 3, 3 ), 2, 2);
    imshow("Gaus",dst_Gaussian);

    //findContours(dst, contours, hierarchy, int mode, int method, Point offset=Point());
    Canny( dst_Gaussian, dst_Gaussian, 100, 100*3, 3 );
     dst_Canny = Scalar::all(0);

    dis.copyTo( dst_Canny, dst_Gaussian);
    imshow("canny", dst_Canny);

"dises is a pointer."

Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-12-10 04:02:50 -0600

In the Canny function input image have to single-channel 8-bit .For the threshold1 & threshold2 should be in range 0 to 255.

edit flag offensive delete link more

Comments

I changed the CV_32FC1 type to the CV_8UC1. but I got strange output! I think I am loosing some useful data by changing its type! am I right?

ati gravatar imageati ( 2013-12-10 05:28:59 -0600 )edit

Question Tools

Stats

Asked: 2013-12-10 03:41:26 -0600

Seen: 610 times

Last updated: Dec 10 '13