Ask Your Question

Regarding understanding Canny's parameters?

asked 2016-10-11 03:10:28 -0500

AMEMB gravatar image

updated 2016-10-11 03:16:28 -0500

I am trying to learn how to make edge detection, so i referred to some tutorials such as the one in this link I followed the steps as stated but what i could not understand is the last four parameters set to the function of .Canny()!! I manipulated the parameters but i always get the same results and i could not notice any difference in the output. would you please explain what are these parameters really doing? and how to realize their effect


//step 1
this.mMatGray = new Mat();
Imgproc.cvtColor(this.mMatInputFrame, this.mMatGray, Imgproc.COLOR_BGR2GRAY);

//step 2
this.mMatEdges = new Mat();
Imgproc.blur(this.mMatGray, this.mMatEdges, new Size(5, 5));

//step 3
Imgproc.Canny(this.mMatEdges, this.mMatEdges, 100, 1, 5, true);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-10-11 12:03:01 -0500

matman gravatar image

A description of how Canny works shows wikipedia, whereas the OpenCV version doesn't use the Gaussian filter step, you have to do it by yourself if you want. The parameters are described here. Sometimes it is helps to read the documentation ;).

That you get the same results for different parameters is a feature of Canny because an edge is defined by the local maximum gradient.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-10-11 03:10:28 -0500

Seen: 105 times

Last updated: Oct 11 '16