Canny edge detector

Source: Internet
Author: User
Tags scale image
Canny edge detector

 


Common names:Canny edge detector

 

Brief Description

The Canny operator was designed to be an optimal edge detector (according to particle criteria --- there are other detectors around that also claim to be optimal with respect to slightly different criteria ). it takes as input a gray scale image, and produces as output an image showing the positions of Tracked intensity discontinuities.

 

How it works

The Canny operator works in a multi-stage process. first of all the image is smoothed by Gaussian convolution. then a simple 2-D First Derivative Operator (somewhat like the Robert ts cross) is applied to the smoothed image to highlight regions of the image with high first spatial derivatives. edges give rise to ridges in the gradient magn1_image. the algorithm then tracks along the top of these ridges and sets to zero all pixels that are not actually on the ridge top so as to give a thin line in the output, a process knownNon-maximal Suppression. The tracking process exhibits hysteresis controlled by two thresholds:T1AndT2,T1> T2. Tracking can only begin at a point on a ridge higherT1. Tracking then continues in both directions out from that point until the height of the ridge falls belowT2. This hysteresis helps to ensure that noisy edges are not broken up into multiple edge fragments.

Guidelines for Use

The effect of the Canny operator is determined by three parameters --- the width of the Gaussian Kernel used in the smoothing phase, and the upper and lower thresholds used by the tracker. increasing the width of the Gaussian Kernel generated CES the detector's sensitivity to noise, at the expense of losing some of the finer detail in the image. the localization error in the detected edges also increases slightly as the Gaussian width is increased.

Usually, the upper tracking threshold can be set quite high, and the lower threshold quite low for good results. setting the lower threshold too high will cause noisy edges to break up. setting the upper threshold too low increases the number of spurous and undesirable edge fragments appearing in the output.

One problem with the basic Canny operator is to do with Y-JunctionsI. e.Places where three ridges meet in the gradient magn1_image. such junctions can occur where an edge is partially occluded by another object. the tracker will treat two of the ridges as a single line segment, and the third one as a line that approaches, but doesn' t quite connect to, that line segment.

We use the image

To demonstrate the effect of the Canny operator on a natural scene.

Using a Gaussian Kernel with standard deviation 1.0 and upper and lower thresholds of 255 and 1, respectively, we obtain

Most of the major edges are detected and lots of details have been picked out well --- Note that this may be too much detail for subsequent processing. the 'Y-junction effect 'mentioned above can be seen at the bottom left corner of the mirror.

The image

Is obtained using the same kernel size and upper threshold, but with the lower threshold increased to 220. the edges have become more broken up than in the previous image, which is likely to be bad for subsequent processing. also, the vertical edges on the wall have not been detected, along their full length.

The image

Is obtained by lowering the upper threshold to 128. the lower threshold is kept at 1 and the Gaussian standard deviation remains at 1.0. faster more faint edges are detected along with some short 'noisy' fragments. notice that the detail in the clown's hair is now picked out.

The image

Is obtained with the same thresholds as the previous image, but the Gaussian used has a standard deviation of 2.0. much of the detail on the wall is no longer detected, but most of the strong edges remain. the edges also tend to be smoother and less noisy.

Edges in artificial scenes are often sharper and less complex than those in natural scenes, and this generally improves the performance of any edge detector.

The image

Shows such an artificial scene, and

Is the output from the Canny operator.

The Gaussian smoothing in the Canny edge detector fulfills two purposes: first it can be used to control the amount of detail that appears in the edge image and second, it can be used to suppress noise.

To demonstrate how the Canny operator performs on noisy images we use

Which Contains Gaussian noise with a standard deviation15. Neither the Robert ts cross nor the Sobel operator are able to detect the edges of the object while removing all the noise in the image. Applying the skilled operator using a standard deviation1.0Yields

All the edges have been detected and almost all of the noise has been removed. For comparison,

Is the result of applying the Sobel operator and thresholding the output at a value150.

We use

To demonstrate how to control the details contained in the resulting edge image. The image

Is the result of applying the Canny edge detector using a standard deviation1.0And an upper and lower threshold255And1, Respectively. this image contains detail details; however, for an automatic recognition task we might be interested to obtain only lines that correspond to the boundaries of the objects. if we increase the standard deviation for the Gaussian smoothing1.8, The Canny operator yields

Now, the edges corresponding to the uneveness of the surface have disappeared from the image, but some edges corresponding to changes in the surface orientation remain. although these edges are 'weaker 'than the boundaries of the objects, the resulting pixel values are the same, due to the saturation of the image. hence, if we scale down the image before the edge detection, we can use the upper threshold of the edge tracker to remove the weaker edges. the image

Is the result of first scaling the image0.25And then applying the Canny operator using a standard deviation1.8And an upper and lower threshold200And1, Respectively. The image shows the desired result that all the boundaries of the objects have been detected whereas all other edges have been removed.

Although the Canny edge detector allows us the find the intensity discontinuities in an image, it is not guaranteed that these discontinuities correspond to actual edges of the object. This is already strated using

We obtain

By using a standard deviation1.0And an upper and lower threshold255And1, Respectively. in this case, some edges of the object do not appear in the image and specify edges in the image originate only from reflections on the object. it is a demanding task for an automatic system to interpret this image. we try to improve the edge image by decreasing the upper threshold150, As can be seen in

We now obtain most of the edges of the object, but we also increase the amount of noise. The result of further decreasing the upper threshold100And increasing the standard deviation2Is shown in

 

 

Common variants

The problem with Y-junctions mentioned above can be solved by including a model of such junctions in the ridge tracker. This will ensure that no spurous gaps are generated at these junctions.

 

Interactive experimentation

You can interactively experiment with this operator by clicking here.

 

Exercises

 

  1. Adjust the parameters of the Canny operator so that you can detect the edges

    While removingAllOf the noise.

     

  2. What effect does increasing the Gaussian Kernel size have on the magnitudes of the gradient maxima at edges? What change does this imply has to be made to the tracker thresholds when the kernel size is increased?

     

  3. It is sometimes easier to evaluate edge detector performance after thresholding the edge detector output at some low gray scale value (E.g.1) so that all detected edges are marked by bright white pixels. Try this out on the third and fourth example images of the clown mentioned above. Comment on the differences between the two images.

     

  4. How does the Canny operator compare with the Robert ts cross and Sobel edge detectors in terms of speed? What do you think is the slowest stage of the process?

     

  5. How does the Canny operator compare in terms of noise rejection and edge detection with other operators such as the Robert ts cross and Sobel operators?

     

  6. How does the quick operator compare with other edge detectors on Simple artificial 2-D scenes? And on more complicated natural scenes?

     

  7. Under what situations might you choose to use the Canny operator rather than the Robert ts cross or Sobel operators? In what situations wocould you definitely not choose it?

 

References

R. Boyle and R. Thomas Computer Vision: a first course, Blackwell Scientific Publications, 1988, p 52.

J. Canny A computational approach to edge detection, IEEE Transactions on Pattern Analysis and machine intelligence, vol. 8, No. 6, nov. 1986.

E. Davies Machine Vision: Theory, algorithms and practicalities, Academic Press, 1990, chap. 5.

R. gonzarez and R. Woods Digital Image Processing, Addison-weari Publishing Company, 1992, chap. 4.

 

Local Information

Specific information about this operator may be found here.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.