Edge Detection
Last updated
Last updated
Copyright (c) Brandeis University
The detection of edges in image processing is very important when needing to find straight lines in pictures using a camera. One of the most popular ways to do so is using an algorithm called a Canny Edge Detector. This algorithm was developed by John F. Canny in 1986 and there are 5 main steps to using it. Below are examples of the algorithm in use:
The second image displays the result of using canny edge detection on the first image.
Apply Gaussian filter to smooth image
Find intensity gradients of image
Apply gradient magnitude thresholding or lower bound cut-off suppression to remove false results
Track edge by surprisessing weak edges so only strong ones appear
The below function demonstrates how to use this algorithm:
First, the image is converting into something usable by cv. It is then grayed and the intensity gradient for the kernel is found
The image is then blurred for canny preparation.
The lower and upper bounds are decided and the Canny algorithm is run on the image. In the case of this function, the new image is then published to a topic called "canny mask" for use by another node.
The above code was created for use in a project completed by myself and fellow student Adam Ring