latest version v1.9 - last update 10 Apr 2010 |
The Canny Edge Detector is a standard algorithm, designed to detect "optimal" edges. More...
#include <ltiCannyEdges.h>
Classes | |
class | parameters |
the parameters for the class cannyEdges More... | |
Public Member Functions | |
cannyEdges () | |
cannyEdges (const parameters &thePars) | |
cannyEdges (const cannyEdges &other) | |
virtual | ~cannyEdges () |
virtual const char * | getTypeName () const |
virtual bool | apply (channel8 &srcdest) const |
virtual bool | apply (channel &srcdest) const |
virtual bool | apply (const channel8 &src, channel8 &dest) const |
virtual bool | apply (const channel8 &src, channel8 &edges, channel &orientation) const |
virtual bool | apply (const channel &src, channel &dest) const |
virtual bool | apply (const channel &src, channel8 &dest) const |
virtual bool | apply (const channel &src, channel8 &edges, channel &orientation) const |
virtual bool | apply (const image &src, channel8 &dest) const |
virtual bool | apply (const image &src, channel8 &dest, channel &orientation) const |
virtual bool | apply (image &srcdest) const |
virtual bool | apply (const image &src, image &dest) const |
virtual bool | apply (const channel &c1, const channel &c2, const channel &c3, channel8 &edges, channel &orientation) const |
cannyEdges & | copy (const cannyEdges &other) |
cannyEdges & | operator= (const cannyEdges &other) |
virtual functor * | clone () const |
virtual bool | updateParameters () |
const parameters & | getParameters () const |
The Canny Edge Detector is a standard algorithm, designed to detect "optimal" edges.
Almost every image processing book (e.g. Sonka et.al Image Processing, Analysis and Machine Vision) explains the details for the algorithm.
As all other edge detectors in this Library, the colors for the edges and background are specified in the parameters (see lti::edgeDetector::parameters)
The construction of the first cannyEdges functor in your application will take some time to initialize a Look-Up-Table that allows a much faster edge detection later (about 0.13 seconds on a Pentium III, 450MHz). The LUT will require about 1MB. Please see lti::arctanLUT for more information.
You can also choose between the "classic" simple gradient operator, which considers only two neighbors at each axis x
and y
or the more accurate gradient kernels (see lti::gradientKernelX). In the latter mode, the edge detection is about a factor 2 slower.
For color images the color contrast gradient is used.
lti::cannyEdges::cannyEdges | ( | ) |
default constructor
lti::cannyEdges::cannyEdges | ( | const parameters & | thePars | ) |
constructor with parameters
lti::cannyEdges::cannyEdges | ( | const cannyEdges & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::cannyEdges::~cannyEdges | ( | ) | [virtual] |
destructor
virtual bool lti::cannyEdges::apply | ( | const channel & | c1, | |
const channel & | c2, | |||
const channel & | c3, | |||
channel8 & | edges, | |||
channel & | orientation | |||
) | const [virtual] |
Strictly speaking, this method does not do a Canny Edge Detection any more, but, because of the strong similarity with the Canny later stages, it is provided here.
The problem lies in the definition of the "gradient" for a color channel. Here, the approach introduced in A. Cumani, "Edge Detection in Multispectral Images", Technical Report, Istituto Elettrotecnico Nazionale "Galileo Ferraris", 1989 is followed.
With this approach, instead of the usual gradient, the maxima of the contrast function are searched. The contrast function defines the direction in the (x,y) plane at which the contrast change is maximal. See lti::colorContrastGradient for more information.
The Canny-typical non-maxima suppression procedure is applied on the contrast result.
c1 | first channel | |
c2 | second channel | |
c3 | third channel | |
edges | the found edges | |
orientation | orientation of the found angles. |
Compute the edges for the red, green and blue components of the image and leave the result in each channel of the destination image.
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::apply | ( | image & | srcdest | ) | const [virtual] |
Compute the edges for the red, green and blue components of the image and leave the result in each channel of image.
srcdest | image with the source data. The result will be left here too. |
Reimplemented from lti::edgeDetector.
Strictly speaking, this method does not do a Canny Edge Detection any more, but, because of the strong similarity with the Canny later stages, it is provided here.
The problem lies in the definition of the "gradient" for a color channel. Here, the approach introduced in A. Cumani, "Edge Detection in Multispectral Images", Technical Report, Istituto Elettrotecnico Nazionale "Galileo Ferraris", 1989 is followed.
With this approach, instead of the usual gradient, the maxima of the contrast function are searched. The contrast function defines the direction in the (x,y) plane at which the contrast change is maximal. See lti::colorContrastGradient for more information.
The Canny-typical non-maxima suppression procedure is applied on the contrast result.
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::apply | ( | const channel & | src, | |
channel8 & | edges, | |||
channel & | orientation | |||
) | const [virtual] |
compute the canny edges for the given source channel.
The found edges will be left on the edges channel, and the orientation angle of the edges (that can be used in other functors, like the hough transform) is left on the orientation channel.
src | channel with the source data. | |
edges | channel8 where the result will be left. | |
orientation | channel where the orientation for the channel will be left. |
operates on a copy of the given parameters.
Reimplemented from lti::edgeDetector.
operates on a copy of the given parameters.
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::apply | ( | const channel8 & | src, | |
channel8 & | edges, | |||
channel & | orientation | |||
) | const [virtual] |
compute the canny edges for the given source channel.
The found edges will be left on the edges channel, and the orientation angle of the edges (that can be used in other functors, like the hough transform) is left on the orientation channel.
src | channel8 with the source data. | |
edges | channel8 where the result will be left. | |
orientation | channel where the orientation for the channel will be left. |
operates on a copy of the given parameters.
This one is the fastest, because it won't require casting the channel to any other type.
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::apply | ( | channel & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel with the source data. The result will be left here too. |
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::apply | ( | channel8 & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel8 with the source data. The result will be left here too. |
Reimplemented from lti::edgeDetector.
virtual functor* lti::cannyEdges::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::edgeDetector.
cannyEdges& lti::cannyEdges::copy | ( | const cannyEdges & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::edgeDetector.
const parameters& lti::cannyEdges::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::edgeDetector.
virtual const char* lti::cannyEdges::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("cannyEdges")
Reimplemented from lti::edgeDetector.
cannyEdges& lti::cannyEdges::operator= | ( | const cannyEdges & | other | ) |
alias for copy member
other | the functor to be copied |
Reimplemented from lti::edgeDetector.
virtual bool lti::cannyEdges::updateParameters | ( | ) | [virtual] |
set functor's parameters.
This member makes a copy of theParam: the functor will keep its own copy of the parameters!
Reimplemented from lti::functor.