KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::Canny_edge_detector Class Reference

Implements the Canny edge detection algorithm. More...

#include <edge.h>

Public Member Functions

 Canny_edge_detector (float sigma=1, float begin_thresh=0, float end_thresh=0, size_t padding=0, bool use_fourier=true)
 
Canny_edge_detectoroperator= (const Canny_edge_detector &other)
 
void swap (Canny_edge_detector &other)
 
Edge_set_ptr operator() (const Image &img, bool noiseless_data=false) const
 
kjb::Edge_setdetect_edges (const Image &img, bool noiseless_data=false)
 Detect edges in img. More...
 

Detailed Description

Implements the Canny edge detection algorithm.

See http://en.wikipedia.org/wiki/Canny_edge_detector.

We get rid of noise by first convolving the image with a Gaussian filter with standard deviation sigma. A gradient map is then computed using finite differences. The first threhsold is used to determine edge pixels and non edge pixels (non maxima suppression). We build edges by starting from edge pixels and following the gradient direction until we find a pixel whose gradient is lower than the second threshold (hysteresis).

Constructor & Destructor Documentation

kjb::Canny_edge_detector::Canny_edge_detector ( float  sigma = 1,
float  begin_thresh = 0,
float  end_thresh = 0,
size_t  padding = 0,
bool  use_fourier = true 
)
inline
Parameters
sigmaGaussian blurring sigma. Determines scale of edges to detect.
begin_threshStarting edge threshold hysteresis in the Canny edge detection algorithm. Lower value gives more edges.
end_threshEnding edge threshold for hysteresis in the Canny edge detection algorithm. Lower value gives longer edges. If it exceeds begin_thresh it isn't really hysteresis.
paddingAmount of padding to add to images before detecting edges. Images are padded by repeating the values occurring at image boundaries. Positive padding can prevent spurious edge detections on image boundary. If using, consider a value of around 2*sigma.
use_fourierSpecifies whether to use Fast Fourier transform for convolution or not.

Note that each argument has a default value.

Member Function Documentation

kjb::Edge_set* kjb::Canny_edge_detector::detect_edges ( const Image img,
bool  noiseless_data = false 
)
inline

Detect edges in img.

This returns a pointer. It is up to the user to clean up the memory to which it points.

Parameters
img.The image to run the edge detection on
noiseless_dataSet to true if the image is noise free, meaning that each pixel whose intensity is bigger than zero is an edge point
Edge_set_ptr kjb::Canny_edge_detector::operator() ( const Image img,
bool  noiseless_data = false 
) const
inline

Detect edges in img

The design decision to return a pointer is motivated by the fact that many objects may share this data.

Parameters
imgThe image to run the edge detector on
noiseless_dataSet to true if the image is noise free, meaning that each pixel whose intensity is bigger than zero is an edge point
Canny_edge_detector& kjb::Canny_edge_detector::operator= ( const Canny_edge_detector other)
inline
void kjb::Canny_edge_detector::swap ( Canny_edge_detector other)
inline

Swaps the content of this edge detector with the edge detector provided in input


The documentation for this class was generated from the following file: