KJB
|
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_detector & | operator= (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_set * | detect_edges (const Image &img, bool noiseless_data=false) |
Detect edges in img. More... | |
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).
|
inline |
sigma | Gaussian blurring sigma. Determines scale of edges to detect. |
begin_thresh | Starting edge threshold hysteresis in the Canny edge detection algorithm. Lower value gives more edges. |
end_thresh | Ending 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. |
padding | Amount 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_fourier | Specifies whether to use Fast Fourier transform for convolution or not. |
Note that each argument has a default value.
|
inline |
Detect edges in img.
This returns a pointer. It is up to the user to clean up the memory to which it points.
img. | The image to run the edge detection on |
noiseless_data | Set to true if the image is noise free, meaning that each pixel whose intensity is bigger than zero is an edge point |
|
inline |
Detect edges in img
The design decision to return a pointer is motivated by the fact that many objects may share this data.
img | The image to run the edge detector on |
noiseless_data | Set to true if the image is noise free, meaning that each pixel whose intensity is bigger than zero is an edge point |
|
inline |
|
inline |
Swaps the content of this edge detector with the edge detector provided in input