Defines | Functions
core/vil/algo/vil_suppress_non_max_edges.txx File Reference

Given gradient image, compute magnitude and zero any non-maximal values. More...

#include "vil_suppress_non_max_edges.h"
#include <vil/vil_bilin_interp.h>
#include <vil/vil_fill.h>
#include <vcl_cmath.h>
#include <vcl_cassert.h>

Go to the source code of this file.

Defines

#define vil_suppress_non_max_edges_txx_
#define VIL_SUPPRESS_NON_MAX_EDGES_INSTANTIATE(srcT, destT)

Functions

template<class srcT , class destT >
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.
template<class srcT , class destT >
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_moo)
 Given gradient images, computes a subpixel edgemap with magnitudes and orientations.

Detailed Description

Given gradient image, compute magnitude and zero any non-maximal values.

Author:
Tim Cootes

Definition in file vil_suppress_non_max_edges.txx.


Define Documentation

#define VIL_SUPPRESS_NON_MAX_EDGES_INSTANTIATE (   srcT,
  destT 
)
Value:
template 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);\
template 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_moo)

Definition at line 229 of file vil_suppress_non_max_edges.txx.

#define vil_suppress_non_max_edges_txx_

Definition at line 3 of file vil_suppress_non_max_edges.txx.


Function Documentation

template<class srcT , class destT >
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.

Computes magnitude image. Zeros any below a threshold. Points with magnitude above a threshold are tested against gradient along normal to the edge and retained only if they are higher than their neighbours.

Note: Currently assumes single plane only. 2 pixel border around output set to zero

Definition at line 24 of file vil_suppress_non_max_edges.txx.

template<class srcT , class destT >
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_moo 
)

Given gradient images, computes a subpixel edgemap with magnitudes and orientations.

Computes magnitude image. Zeros any below a threshold. Points with magnitude above a threshold are tested against gradient along normal to the edge and retained only if they are higher than their neighbours. The magnitude of retained points is revised using parabolic interpolation in the normal direction. The same interpolation provides a subpixel offset from the integral pixel location.

This algorithm returns a 3-plane image where the planes are:

  • 0 - The interpolated peak magnitude
  • 1 - The orientation (in radians)
  • 2 - The offset to the subpixel peak in the gradient direction All non-maximal edge pixel have the value zero in all three planes.
    See also:
    vil_orientations_at_edges
    The subpixel location for pixel (i,j) is computed as
        double theta = grad_mag_orient_offset(i,j,1);
        double offset = grad_mag_orient_offset(i,j,2);
        double x = i + vcl_cos(theta)*offset;
        double y = j + vcl_sin(theta)*offset;
    

Note: Currently assumes single plane only. 2 pixel border around output set to zero. If two neighbouring edges have exactly the same strength, it retains both (ie an edge is eliminated if it is strictly lower than a neighbour, but not if it is the same as two neighbours).

Definition at line 139 of file vil_suppress_non_max_edges.txx.