Thread View: sci.image.processing
4 messages
4 total messages
Started by S A J Winder
Thu, 06 Aug 1992 21:12
Canny Edge Detector
Author: S A J Winder
Date: Thu, 06 Aug 1992 21:12
Date: Thu, 06 Aug 1992 21:12
78 lines
4242 bytes
4242 bytes
In reply to: colaluca@cs.utexas.edu (Mark Colaluca)
> I am working on using a Canny Edge Operator to detect image edges...
> Also, if anyone has experience using the Canny operator, I'd appreciate
> your comments, suggestions, etc.
Here's how I have implemented the basic Canny edge operator. This may
be of use to a few people...
1. Smooth the image with a Gaussian kernel. This has the form:
G(r) = 1/(2*pi*sigma*sigma) * exp(-r*r/(2*sigma)) for the 2D case,
where sigma is the smoothing factor. You can do this in two 1D
operations with G(x) = 1/(sigma*sqrt(2*pi)) * exp(-x*x/(2*sigma))
-- first smooth horizontally, then smooth the result vertically.
* NOTE: this smoothed result must be stored in floating point format
otherwise you will get crazy results when you apply the second
derivative operator!
2. Compute the gradient magnitude of the smoothed image. This is used
later to validate edge segments. Compute the second derivative in
the direction of the gradient vector. This function passes through
zero at the position of each edge (you hope!) Here's some code to do
this inside an xy loop:
aa = smoothed_image(x-1,y-1); /* Insert you're own */
bb = smoothed_image(x,y-1); /* favourite method of */
cc = smoothed_image(x+1,y-1); /* getting at pixels */
dd = smoothed_image(x-1,y);
ee = smoothed_image(x,y);
ff = smoothed_image(x+1,y);
gg = smoothed_image(x-1,y+1); /* Note all variables */
hh = smoothed_image(x,y+1); /* are floating point */
ii = smoothed_image(x+1,y+1);
dfdx = ff-dd; /* Scaling factors omitted */
dfdy = bb-hh;
dfdxs = dfdx*dfdx;
dfdys = dfdy*dfdy;
gradient_magnitude = sqrt(dfdxs+dfdys);
canny_function = (dd+ff-2.0*ee)*dfdxs+(bb+hh-2.0*ee)*dfdys+
(cc+gg-aa-ii)*dfdx*dfdy/2.0;
* NOTE: the normalisation is omitted for the derivative and Canny
functions because the former is subject to dynamic thresholding
and the latter is used only to provide zero-crossing information.
3. Next make a bitmap image, setting pixels to one wherever
canny_function>0.0 to get a two-value image whose region boundaries
correspond to edge positions. You can then convert this into a
binary edge map by comparing pixels within a neighbourhood. Every
possible edge that could be detected at one scale using Canny's
method is represented in such a map.
* NOTE: I have never had canny_function return a value of 0.0 for real
images---rather it alternates between large positive and negative values.
Also "phantom edges" are removed by the thresholding stage...
4. Implement Canny's two-level thresholding technique: you need to
decide on two suitable threshold values to apply to the gradient
magnitude image you computed earlier. This is best done automatically
with reference to the range of gradient values found from the image.
Fixed thresholds fail to cater for changes in image contrast and
smoothing factor.
For every edge point detected in (3), check the gradient
magnitude at the same point against the two thresholds. Produce a
high-threshold edge map and a low-threshold edge map. The high-threshold
map will have the major edges and the low-threshold map will have these
plus some more detail and unwanted edges.
To complete the edge synthesis computation you need to write an
algorithm that walks along all the high-threshold edges copying them
onto another bitmap together with any connected edges in the low-
threshold map.
Simon.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simon A.J. Winder Computer Vision Research
sajw@uk.ac.bath.maths University of Bath
Tel: +44 (0)225 826183 /\/\/\/\/\/\/\/\/\/\/\/\
Re: Canny Edge Detector
Author: Hans DU BUF
Date: Fri, 07 Aug 1992 10:17
Date: Fri, 07 Aug 1992 10:17
6 lines
653 bytes
653 bytes
The interested hobbyists experimenting with the CAnny edge detector should take a look at the recent papers by Margaret Fleck BEFORE starting to experiment. Just scan IEEE PAMI, I don't have a copy here. All the best, Hans
Re: Canny Edge Detector
Author: Dr. Steven L. Eddins
Date: Fri, 07 Aug 1992 13:24
Date: Fri, 07 Aug 1992 13:24
23 lines
1310 bytes
1310 bytes
dubuf@sicsun.epfl.ch (Hans DU BUF) writes: >The interested hobbyists experimenting with the CAnny edge detector >should take a look at the recent papers by Margaret Fleck BEFORE >starting to experiment. Just scan IEEE PAMI, I don't have a copy here. >All the best, >Hans The references are: M. M. Fleck, "Some Defects in Finite-Difference Edge Finders," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 14, n. 3, March 1992, pp. 337-345. M. M. Fleck, "Multiple Widths Yield Reliable Finite Differences," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 14, n. 4, April 1992, pp. 412-429. -- Steve Eddins eddins@holst.eecs.uic.edu (312) 996-5771 FAX: (312) 413-0024 University of Illinois at Chicago, EECS Dept., M/C 154, 1120 SEO Bldg, Box 4348, Chicago, IL 60680
Re: Canny Edge Detector
Author: Irek Defee
Date: Sat, 08 Aug 1992 06:54
Date: Sat, 08 Aug 1992 06:54
37 lines
1994 bytes
1994 bytes
In article <1992Aug7.132410.29816@bert.eecs.uic.edu> eddins@bert.eecs.uic.edu (Dr. Steven L. Eddins) writes: >>The interested hobbyists experimenting with the CAnny edge detector >>should take a look at the recent papers by Margaret Fleck BEFORE >>starting to experiment. Just scan IEEE PAMI, I don't have a copy here. >>Hans >The references are: >M. M. Fleck, "Some Defects in Finite-Difference Edge Finders," IEEE >Transactions on Pattern Analysis and Machine Intelligence, vol. 14, n. >3, March 1992, pp. 337-345. >M. M. Fleck, "Multiple Widths Yield Reliable Finite Differences," IEEE >Transactions on Pattern Analysis and Machine Intelligence, vol. 14, n. >4, April 1992, pp. 412-429. Very good reading, indeed. Then, add to the Marr-Hildreth and Canny optimal edge detectors; J. Shen, S. Castan, "An Optimal Linear Operator for Step Edge Detection," CVGIP: Graphics Models and Image Processing, vol. 54, No. 2, March 1992, pp. 112-133. But, for God's sake, before developing any new (optimal or not) edge detectors, read please: R. C. Jain, T. O. Binford, "Ignorance, Myopia and Naivete in Computer Vision Systems," CVGIP: Image Understanding, vol. 53, No. 1, Jan. 1991, pp. 112-117, 1991. T. Pavlidis, "Why Progress in Machine Vision Is So Slow," Pattern Recognition Letters vol. 13, April 1992, pp. 221-225. Irek Defee Signal Processing Laboratory, Tampere University of Technology, Tampere, Finland, Europe. --
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads