Working with the Canny edge detector
The Canny edge detection algorithm was developed by John Canny. Canny's algorithm heavily uses the concept of high-pass filters. It has multiple steps.
Note:
You can read more about the Canny edge detection algorithm at http://homepages.inf.ed.ac.uk/rbf/HIPR2/canny.htm.
OpenCV has the cv2.Canny()
function, which offers Canny's algorithm. The following are the steps of the algorithm:
- A Gaussian kernel with a size of 5 x 5 pixels is applied to the input image to remove any noise.
- Then, we compute the gradient of the intensity of the filtered image. We can use the L1 or the L2 norm for this step.
- We then apply non-maximum suppression and identify the candidates for the possible sets of edges.
- The final step is the operation of hysteresis. We finalize the edges depending on the thresholds passed to the images.
Note:
You can read more about the L1 and L2 norms and non-maximum suppression at http://www.chioka.in/differences...