vil_suppress_non_max_edges.h
Go to the documentation of this file.
1 // This is core/vil/algo/vil_suppress_non_max_edges.h
2 #ifndef vil_suppress_non_max_edges_h_
3 #define vil_suppress_non_max_edges_h_
4 //:
5 // \file
6 // \brief Given gradient image, compute magnitude and zero any non-maximal values
7 // \author Tim Cootes
8 //
9 // \verbatim
10 // Modifications
11 // Matt Leotta - Aug 22, 2008 - Added a parabolic subpixel version
12 // \endverbatim
13 
14 #include <vil/vil_image_view.h>
15 
16 //: Given gradient images, computes magnitude image containing maximal edges
17 // Computes magnitude image. Zeros any below a threshold.
18 // Points with magnitude above a threshold are tested against gradient
19 // along normal to the edge and retained only if they are higher than
20 // their neighbours.
21 //
22 // Note: Currently assumes single plane only.
23 // 2 pixel border around output set to zero.
24 // If two neighbouring edges have exactly the same strength, it retains
25 // both (ie an edge is eliminated if it is strictly lower than a neighbour,
26 // but not if it is the same as two neighbours).
27 //
28 // \relatesalso vil_image_view
29 template<class srcT, class destT>
31  const vil_image_view<srcT>& grad_j,
32  double grad_mag_threshold,
33  vil_image_view<destT>& grad_mag);
34 
35 
36 //: Given gradient images, computes a subpixel edgemap with magnitudes and orientations
37 // Computes magnitude image. Zeros any below a threshold.
38 // Points with magnitude above a threshold are tested against gradient
39 // along normal to the edge and retained only if they are higher than
40 // their neighbours. The magnitude of retained points is revised using
41 // parabolic interpolation in the normal direction. The same interpolation
42 // provides a subpixel offset from the integral pixel location.
43 //
44 // This algorithm returns a 3-plane image where the planes are:
45 // - 0 - The interpolated peak magnitude
46 // - 1 - The orientation (in radians)
47 // - 2 - The offset to the subpixel peak in the gradient direction
48 // All non-maximal edge pixel have the value zero in all three planes.
49 // \sa vil_orientations_at_edges
50 //
51 // The subpixel location for pixel (i,j) is computed as
52 // \code
53 // double theta = grad_mag_orient_offset(i,j,1);
54 // double offset = grad_mag_orient_offset(i,j,2);
55 // double x = i + std::cos(theta)*offset;
56 // double y = j + std::sin(theta)*offset;
57 // \endcode
58 //
59 // Note: Currently assumes single plane only.
60 // 2 pixel border around output set to zero.
61 // If two neighbouring edges have exactly the same strength, it retains
62 // both (ie an edge is eliminated if it is strictly lower than a neighbour,
63 // but not if it is the same as two neighbours).
64 //
65 // \relatesalso vil_image_view
66 template<class srcT, class destT>
68  const vil_image_view<srcT>& grad_j,
69  double grad_mag_threshold,
70  vil_image_view<destT>& grad_mag_orient_offset);
71 
72 #endif // vil_suppress_non_max_edges_h_
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
void vil_suppress_non_max_edges(const vil_image_view< srcT > &grad_i, const vil_image_view< srcT > &grad_j, double grad_mag_threshold, vil_image_view< destT > &grad_mag)
Given gradient images, computes magnitude image containing maximal edges.
A base class reference-counting view of some image data.
void vil_suppress_non_max_edges_subpixel(const vil_image_view< srcT > &grad_i, const vil_image_view< srcT > &grad_j, double grad_mag_threshold, vil_image_view< destT > &grad_mag_orient_offset)
Given gradient images, computes a subpixel edgemap with magnitudes and orientations.