Edge Detection

Edge detectors based on first and second derivatives, and related post-processing. More...

Namespaces

namespace  vigra::detail

Classes

class  vigra::Edgel
 Helper class that stores edgel attributes. More...

Functions

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::differenceOfExponentialEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold, DestValue edge_marker)
 Detect and mark edges in an edge image using the Shen/Castan zero-crossing detector.
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue>
void vigra::differenceOfExponentialEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::differenceOfExponentialEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold, DestValue edge_marker)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue>
void vigra::differenceOfExponentialEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::differenceOfExponentialCrackEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold, DestValue edge_marker)
 Detect and mark edges in a crack edge image using the Shen/Castan zero-crossing detector.
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::differenceOfExponentialCrackEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold, DestValue edge_marker)
template<class Iterator, class Accessor, class Value>
void vigra::removeShortEdges (Iterator sul, Iterator slr, Accessor sa, unsigned int min_edge_length, Value non_edge_marker)
 Remove short edges from an edge image.
template<class Iterator, class Accessor, class Value>
void vigra::removeShortEdges (triple< Iterator, Iterator, Accessor > src, unsigned int min_edge_length, Value non_edge_marker)
template<class SrcIterator, class SrcAccessor, class SrcValue>
void vigra::closeGapsInCrackEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, SrcValue edge_marker)
 Close one-pixel wide gaps in a cell grid edge image.
template<class SrcIterator, class SrcAccessor, class SrcValue>
void vigra::closeGapsInCrackEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, SrcValue edge_marker)
template<class SrcIterator, class SrcAccessor, class SrcValue>
void vigra::beautifyCrackEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, SrcValue edge_marker, SrcValue background_marker)
 Beautify crack edge image for visualization.
template<class SrcIterator, class SrcAccessor, class SrcValue>
void vigra::beautifyCrackEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, SrcValue edge_marker, SrcValue background_marker)
template<class Image1, class Image2, class BackInsertable>
void vigra::internalCannyFindEdgels (Image1 const &gx, Image1 const &gy, Image2 const &magnitude, BackInsertable &edgels, std::vector< int > p)
template<class SrcIterator, class SrcAccessor, class BackInsertable>
void vigra::cannyEdgelList (SrcIterator ul, SrcIterator lr, SrcAccessor src, BackInsertable &edgels, double scale, std::vector< int > p)
 Simple implementation of Canny's edge detector.
template<class SrcIterator, class SrcAccessor, class BackInsertable>
void vigra::cannyEdgelList (triple< SrcIterator, SrcIterator, SrcAccessor > src, BackInsertable &edgels, double scale, std::vector< int > p)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImage (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold, DestValue edge_marker)
 Detect and mark edges in an edge image using Canny's algorithm.
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImage (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold, DestValue edge_marker)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageFromGradWithThinning (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, GradValue gradient_threshold, DestValue edge_marker, bool addBorder)
 Detect and mark edges in an edge image using Canny's algorithm.
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageFromGradWithThinning (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, GradValue gradient_threshold, DestValue edge_marker, bool addBorder)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageFromGradWithThinning (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, GradValue gradient_threshold, DestValue edge_marker)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageFromGradWithThinning (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, GradValue gradient_threshold, DestValue edge_marker)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageWithThinning (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold, DestValue edge_marker, bool addBorder)
 Detect and mark edges in an edge image using Canny's algorithm.
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageWithThinning (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold, DestValue edge_marker, bool addBorder)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageWithThinning (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, double scale, GradValue gradient_threshold, DestValue edge_marker)
template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void vigra::cannyEdgeImageWithThinning (triple< SrcIterator, SrcIterator, SrcAccessor > src, pair< DestIterator, DestAccessor > dest, double scale, GradValue gradient_threshold, DestValue edge_marker)
template<class Image1, class Image2, class BackInsertable>
void vigra::internalCannyFindEdgels3x3 (Image1 const &grad, Image2 const &mask, BackInsertable &edgels)
template<class SrcIterator, class SrcAccessor, class BackInsertable>
void vigra::cannyEdgelList3x3 (SrcIterator ul, SrcIterator lr, SrcAccessor src, BackInsertable &edgels, double scale)
 Improved implementation of Canny's edge detector.
template<class SrcIterator, class SrcAccessor, class BackInsertable>
void vigra::cannyEdgelList3x3 (triple< SrcIterator, SrcIterator, SrcAccessor > src, BackInsertable &edgels, double scale)

Detailed Description

Edge detectors based on first and second derivatives, and related post-processing.


Function Documentation

template<class SrcIterator, class SrcAccessor, class SrcValue>
void beautifyCrackEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
SrcValue  edge_marker,
SrcValue  background_marker
[inline]
 

Definition at line 1131 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class SrcValue>
void beautifyCrackEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
SrcValue  edge_marker,
SrcValue  background_marker
 

Beautify crack edge image for visualization.

This algorithm is applied as a post-processing operation of differenceOfExponentialCrackEdgeImage(). The source image must fulfill the requirements of a Crack Edge Image, but will not do so after application of this algorithm. In particular, the algorithm removes zero-cells marked as edges to avoid staircase effects on diagonal lines like this:

    original edge points (*)     resulting edge points

          . * . . .                   . * . . .
          . * * * .                   . . * . .
          . . . * .           =>      . . . * .
          . . . * *                   . . . . *
          . . . . .                   . . . . .

Therfore, this algorithm should only be applied as a vizualization aid, i.e. for human inspection. The algorithm assumes that edges are marked with edge_marker, and background pixels with background_marker. The image's value type must be equality comparable.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class SrcValue>
        void beautifyCrackEdgeImage(
               SrcIterator sul, SrcIterator slr, SrcAccessor sa,
               SrcValue edge_marker, SrcValue background_marker)
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class SrcValue>
        inline
        void beautifyCrackEdgeImage(
                   triple<SrcIterator, SrcIterator, SrcAccessor> src,
               SrcValue edge_marker, SrcValue background_marker)
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(2*w-1, 2*h-1);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
                                         0.8, 4.0, 1);

    // beautify edge image for visualization
    vigra::beautifyCrackEdgeImage(destImageRange(edges), 1, 0);

    // show to the user
    window.open(edges);

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    SrcAccessor::value_type u = src_accessor(src_upperleft);

    u == u
    u != u

    SrcValue background_marker;
    src_accessor.set(background_marker, src_upperleft);

Definition at line 1096 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 1484 of file edgedetection.hxx.

Referenced by HuginLines::detectEdges().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
 

Detect and mark edges in an edge image using Canny's algorithm.

This operator first calls \ref cannyEdgelList() to generate an edgel list for the given image. Then it scans this list and selects edgels whose strength is above the given gradient_threshold. For each of these edgels, the edgel's location is rounded to the nearest pixel, and that pixel marked with the given edge_marker.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        void cannyEdgeImage(
                   SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                   DestIterator dul, DestAccessor da,
                   double scale, GradValue gradient_threshold, DestValue edge_marker);
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        inline void cannyEdgeImage(
                   triple<SrcIterator, SrcIterator, SrcAccessor> src,
                   pair<DestIterator, DestAccessor> dest,
                   double scale, GradValue gradient_threshold, DestValue edge_marker);
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(w,h);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::cannyEdgeImage(srcImageRange(src), destImage(edges),
                                     0.8, 4.0, 1);

Required Interface:

see also: cannyEdgelList().

    DestImageIterator dest_upperleft;
    DestAccessor dest_accessor;
    DestValue edge_marker;

    dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));

Preconditions:

    scale > 0
    gradient_threshold > 0

Definition at line 1461 of file edgedetection.hxx.

References vigra::cannyEdgelList().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 1827 of file edgedetection.hxx.

Referenced by vigra::cannyEdgeImageFromGradWithThinning(), vigra::cannyEdgeImageWithThinning(), and vigra::cannyEdgelList3x3().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 1814 of file edgedetection.hxx.

References vigra::cannyEdgeImageFromGradWithThinning().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
GradValue  gradient_threshold,
DestValue  edge_marker,
bool  addBorder
[inline]
 

Definition at line 1800 of file edgedetection.hxx.

References vigra::cannyEdgeImageFromGradWithThinning().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
GradValue  gradient_threshold,
DestValue  edge_marker,
bool  addBorder
 

Detect and mark edges in an edge image using Canny's algorithm.

The input pixels of this algorithms must be vectors of length 2 (see Required Interface below). It first searches for all pixels whose gradient magnitude is larger than the given gradient_threshold and larger than the magnitude of its two neighbors in gradient direction (where these neighbors are determined by nearest neighbor interpolation, i.e. according to the octant where the gradient points into). The resulting edge pixel candidates are then subjected to topological thinning so that the remaining edge pixels can be linked into edgel chains with a provable, non-heuristic algorithm. Thinning is performed so that the pixels with highest gradient magnitude survive. Optionally, the outermost pixels are marked as edge pixels as well when addBorder is true. The remaining pixels will be marked in the destination image with the value of edge_marker (all non-edge pixels remain untouched).

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        void cannyEdgeImageFromGradWithThinning(
                   SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                   DestIterator dul, DestAccessor da,
                   GradValue gradient_threshold,
                   DestValue edge_marker, bool addBorder = true);
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        void cannyEdgeImageFromGradWithThinning(
                   triple<SrcIterator, SrcIterator, SrcAccessor> src,
                   pair<DestIterator, DestAccessor> dest,
                   GradValue gradient_threshold,
                   DestValue edge_marker, bool addBorder = true);
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(w,h);

    vigra::FVector2Image grad(w,h);
    // compute the image gradient at scale 0.8
    vigra::gaussianGradient(srcImageRange(src), destImage(grad), 0.8);

    // empty edge image
    edges = 0;
    // find edges gradient larger than 4.0, mark with 1, and add border
    vigra::cannyEdgeImageFromGradWithThinning(srcImageRange(grad), destImage(edges),
                                              4.0, 1, true);

Required Interface:

    // the input pixel type must be a vector with two elements
    SrcImageIterator src_upperleft;
    SrcAccessor src_accessor;
    typedef SrcAccessor::value_type SrcPixel;
    typedef NormTraits<SrcPixel>::SquaredNormType SrcSquaredNormType;

    SrcPixel g = src_accessor(src_upperleft);
    SrcPixel::value_type g0 = g[0];
    SrcSquaredNormType gn = squaredNorm(g);

    DestImageIterator dest_upperleft;
    DestAccessor dest_accessor;
    DestValue edge_marker;

    dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));

Preconditions:

    gradient_threshold > 0

Definition at line 1700 of file edgedetection.hxx.

References vigra::detail::cannyEdgeImageFromGrad(), vigra_ext::destImageRange(), vigra::detail::neighborhoodConfiguration(), hugin_utils::norm(), and vigra::detail::SimplePoint< GradValue >::point.

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageWithThinning triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 1962 of file edgedetection.hxx.

Referenced by vigra::cannyEdgeImageWithThinning().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageWithThinning SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 1949 of file edgedetection.hxx.

References vigra::cannyEdgeImageWithThinning().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageWithThinning triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker,
bool  addBorder
[inline]
 

Definition at line 1935 of file edgedetection.hxx.

References vigra::cannyEdgeImageWithThinning().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void cannyEdgeImageWithThinning SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker,
bool  addBorder
 

Detect and mark edges in an edge image using Canny's algorithm.

This operator first calls \ref gaussianGradient() to compute the gradient of the input image, ad then cannyEdgeImageFromGradWithThinning() to generate an edge image. See there for more detailed documentation.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        void cannyEdgeImageWithThinning(
                   SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                   DestIterator dul, DestAccessor da,
                   double scale, GradValue gradient_threshold,
                   DestValue edge_marker, bool addBorder = true);
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class GradValue, class DestValue>
        void cannyEdgeImageWithThinning(
                   triple<SrcIterator, SrcIterator, SrcAccessor> src,
                   pair<DestIterator, DestAccessor> dest,
                   double scale, GradValue gradient_threshold,
                   DestValue edge_marker, bool addBorder = true);
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(w,h);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1, annd add border
    vigra::cannyEdgeImageWithThinning(srcImageRange(src), destImage(edges),
                                     0.8, 4.0, 1, true);

Required Interface:

see also: cannyEdgelList().

    DestImageIterator dest_upperleft;
    DestAccessor dest_accessor;
    DestValue edge_marker;

    dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));

Preconditions:

    scale > 0
    gradient_threshold > 0

Definition at line 1918 of file edgedetection.hxx.

References vigra::cannyEdgeImageFromGradWithThinning(), vigra_ext::destImage(), and vigra_ext::srcImageRange().

template<class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList triple< SrcIterator, SrcIterator, SrcAccessor >  src,
BackInsertable &  edgels,
double  scale,
std::vector< int >  p
[inline]
 

Definition at line 1374 of file edgedetection.hxx.

Referenced by vigra::cannyEdgeImage().

template<class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList SrcIterator  ul,
SrcIterator  lr,
SrcAccessor  src,
BackInsertable &  edgels,
double  scale,
std::vector< int >  p
 

Simple implementation of Canny's edge detector.

This operator first calculates the gradient vector for each pixel of the image using first derivatives of a Gaussian at the given scale. Then a very simple non-maxima supression is performed: for each 3x3 neighborhood, it is determined whether the center pixel has larger gradient magnitude than its two neighbors in gradient direction (where the direction is rounded into octands). If this is the case, a new Edgel is appended to the given vector of edgels. The subpixel edgel position is determined by fitting a parabola to the three gradient magnitude values mentioned above. The sub-pixel location of the parabola's tip and the gradient magnitude and direction are written in the newly created edgel.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class BackInsertable>
        void cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src,
                            BackInsertable & edgels, double scale);
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class BackInsertable>
        void
        cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                       BackInsertable & edgels, double scale);
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h);

    // empty edgel list
    std::vector<vigra::Edgel> edgels;
    ...

    // find edgels at scale 0.8
    vigra::cannyEdgelList(srcImageRange(src), edgels, 0.8);

Required Interface:

    SrcImageIterator src_upperleft;
    SrcAccessor src_accessor;

    src_accessor(src_upperleft);

    BackInsertable edgels;
    edgels.push_back(Edgel());

SrcAccessor::value_type must be a type convertible to float

Preconditions:

    scale > 0

Definition at line 1340 of file edgedetection.hxx.

References vigra_ext::destImage(), vigra::internalCannyFindEdgels(), vigra_ext::srcImage(), and vigra_ext::srcImageRange().

Referenced by Descriptor::createDescriptors().

template<class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList3x3 triple< SrcIterator, SrcIterator, SrcAccessor >  src,
BackInsertable &  edgels,
double  scale
[inline]
 

Definition at line 2124 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList3x3 SrcIterator  ul,
SrcIterator  lr,
SrcAccessor  src,
BackInsertable &  edgels,
double  scale
 

Improved implementation of Canny's edge detector.

This operator first computes pixels which are crossed by the edge using cannyEdgeImageWithThinning(). The gradient magnitude in the 3x3 neighborhood of these pixels are then projected onto the normal of the edge (as determined by the gradient direction). The edgel's subpixel location is found by fitting a parabola through the 9 gradient values and determining the parabola's tip. A new Edgel is appended to the given vector of edgels. Since the parabola is fitted to 9 points rather than 3 points as in cannyEdgelList(), the accuracy is higher.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class BackInsertable>
        void cannyEdgelList3x3(SrcIterator ul, SrcIterator lr, SrcAccessor src,
                               BackInsertable & edgels, double scale);
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class BackInsertable>
        void
        cannyEdgelList3x3(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                          BackInsertable & edgels, double scale);
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h);

    // empty edgel list
    std::vector<vigra::Edgel> edgels;
    ...

    // find edgels at scale 0.8
    vigra::cannyEdgelList3x3(srcImageRange(src), edgels, 0.8);

Required Interface:

    SrcImageIterator src_upperleft;
    SrcAccessor src_accessor;

    src_accessor(src_upperleft);

    BackInsertable edgels;
    edgels.push_back(Edgel());

SrcAccessor::value_type must be a type convertible to float

Preconditions:

    scale > 0

Definition at line 2104 of file edgedetection.hxx.

References vigra::cannyEdgeImageFromGradWithThinning(), vigra_ext::destImage(), vigra::internalCannyFindEdgels3x3(), and vigra_ext::srcImageRange().

template<class SrcIterator, class SrcAccessor, class SrcValue>
void closeGapsInCrackEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
SrcValue  edge_marker
[inline]
 

Definition at line 992 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class SrcValue>
void closeGapsInCrackEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
SrcValue  edge_marker
 

Close one-pixel wide gaps in a cell grid edge image.

This algorithm is typically applied as a post-processing operation of differenceOfExponentialCrackEdgeImage(). The source image must fulfill the requirements of a Crack Edge Image, and will still do so after application of this algorithm.

It closes one pixel wide gaps in the edges resulting from this algorithm. Since these gaps are usually caused by zero crossing slightly below the gradient threshold used in edge detection, this algorithms acts like a weak hysteresis thresholding. The newly found edge pixels are marked with the given edge_marker. The image's value type must be equality comparable.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class SrcValue>
        void closeGapsInCrackEdgeImage(
               SrcIterator sul, SrcIterator slr, SrcAccessor sa,
               SrcValue edge_marker)
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor, class SrcValue>
        inline
        void closeGapsInCrackEdgeImage(
               triple<SrcIterator, SrcIterator, SrcAccessor> src,
               SrcValue edge_marker)
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(2*w-1, 2*h-1);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
                                         0.8, 4.0, 1);

    // close gaps, mark with 1
    vigra::closeGapsInCrackEdgeImage(srcImageRange(edges), 1);

    // zero edges shorter than 20 pixels
    vigra::removeShortEdges(srcImageRange(edges), 10, 0);

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    SrcAccessor::value_type u = src_accessor(src_upperleft);

    u == u
    u != u

    SrcValue edge_marker;
    src_accessor.set(edge_marker, src_upperleft);

Definition at line 884 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void differenceOfExponentialCrackEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 653 of file edgedetection.hxx.

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void differenceOfExponentialCrackEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
 

Detect and mark edges in a crack edge image using the Shen/Castan zero-crossing detector.

This operator applies an exponential filter to the source image at the given scale and subtracts the result from the original image. Zero crossings are detected in the resulting difference image. Whenever the gradient at a zero crossing is greater than the given gradient_threshold, an edge point is marked (using edge_marker) in the destination image between the corresponding original pixels. Topologically, this means we must insert additional pixels between the original ones to represent the boundaries between the pixels (the so called zero- and one-cells, with the original pixels being two-cells). Within VIGRA, such an image is called Crack Edge Image. To allow insertion of the zero- and one-cells, the destination image must have twice the size of the original (precisely, (2*w-1) by (2*h-1) pixels). Then the algorithm proceeds as follows:

sign of difference image     insert zero- and one-cells     resulting edge points (*)

                                     + . - . -                   . * . . .
      + - -                          . . . . .                   . * * * .
      + + -               =>         + . + . -           =>      . . . * .
      + + +                          . . . . .                   . . . * *
                                     + . + . +                   . . . . .

Thus the edge points are marked where they actually are - in between the pixels. An important property of the resulting edge image is that it conforms to the notion of well-composedness as defined by Latecki et al., i.e. connected regions and edges obtained by a subsequent Labeling do not depend on whether 4- or 8-connectivity is used. The non-edge pixels (.) in the destination image remain unchanged. The result conformes to the requirements of a Crack Edge Image. It can be further improved by the post-processing operations removeShortEdges() and closeGapsInCrackEdgeImage().

The source value type (SrcAccessor::value_type) must be a linear algebra, i.e. addition, subtraction and multiplication of the type with itself, and multiplication with double and NumericTraits must be defined. In addition, this type must be less-comparable.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
              class DestIterator, class DestAccessor,
              class GradValue,
              class DestValue = DestAccessor::value_type>
        void differenceOfExponentialCrackEdgeImage(
               SrcIterator sul, SrcIterator slr, SrcAccessor sa,
               DestIterator dul, DestAccessor da,
               double scale, GradValue gradient_threshold,
               DestValue edge_marker = NumericTraits<DestValue>::one())
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
              class DestIterator, class DestAccessor,
              class GradValue,
              class DestValue = DestAccessor::value_type>
        inline
        void differenceOfExponentialCrackEdgeImage(
               triple<SrcIterator, SrcIterator, SrcAccessor> src,
               pair<DestIterator, DestAccessor> dest,
               double scale, GradValue gradient_threshold,
               DestValue edge_marker = NumericTraits<DestValue>::one())
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(2*w-1,2*h-1);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
                                     0.8, 4.0, 1);

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    SrcAccessor::value_type u = src_accessor(src_upperleft);
    double d;
    GradValue gradient_threshold;

    u = u + u
    u = u - u
    u = u * u
    u = d * u
    u < gradient_threshold

    DestValue edge_marker;
    dest_accessor.set(edge_marker, dest_upperleft);

Preconditions:

    scale > 0
    gradient_threshold > 0

The destination image must have twice the size of the source:

    w_dest = 2 * w_src - 1
    h_dest = 2 * h_src - 1

Definition at line 468 of file edgedetection.hxx.

References vigra_ext::destImage(), and vigra_ext::srcImageRange().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue>
void differenceOfExponentialEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold
[inline]
 

Definition at line 322 of file edgedetection.hxx.

Referenced by vigra::differenceOfExponentialEdgeImage().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void differenceOfExponentialEdgeImage triple< SrcIterator, SrcIterator, SrcAccessor >  src,
pair< DestIterator, DestAccessor >  dest,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
[inline]
 

Definition at line 306 of file edgedetection.hxx.

References vigra::differenceOfExponentialEdgeImage().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue>
void differenceOfExponentialEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold
[inline]
 

Definition at line 293 of file edgedetection.hxx.

References vigra::differenceOfExponentialEdgeImage().

template<class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class GradValue, class DestValue>
void differenceOfExponentialEdgeImage SrcIterator  sul,
SrcIterator  slr,
SrcAccessor  sa,
DestIterator  dul,
DestAccessor  da,
double  scale,
GradValue  gradient_threshold,
DestValue  edge_marker
 

Detect and mark edges in an edge image using the Shen/Castan zero-crossing detector.

This operator applies an exponential filter to the source image at the given scale and subtracts the result from the original image. Zero crossings are detected in the resulting difference image. Whenever the gradient at a zero crossing is greater than the given gradient_threshold, an edge point is marked (using edge_marker) in the destination image on the darker side of the zero crossing (note that zero crossings occur between pixels). For example:

    sign of difference image     resulting edge points (*)

        + - -                          * * .
        + + -               =>         . * *
        + + +                          . . .

Non-edge pixels (.) remain untouched in the destination image. The result can be improved by the post-processing operation removeShortEdges(). A more accurate edge placement can be achieved with the function differenceOfExponentialCrackEdgeImage().

The source value type (SrcAccessor::value_type) must be a linear algebra, i.e. addition, subtraction and multiplication of the type with itself, and multiplication with double and NumericTraits must be defined. In addition, this type must be less-comparable.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
              class DestIterator, class DestAccessor,
              class GradValue,
              class DestValue = DestAccessor::value_type>
        void differenceOfExponentialEdgeImage(
               SrcIterator sul, SrcIterator slr, SrcAccessor sa,
               DestIterator dul, DestAccessor da,
               double scale, GradValue gradient_threshold,
               DestValue edge_marker = NumericTraits<DestValue>::one())
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
              class DestIterator, class DestAccessor,
              class GradValue,
              class DestValue = DestAccessor::value_type>
        inline
        void differenceOfExponentialEdgeImage(
               triple<SrcIterator, SrcIterator, SrcAccessor> src,
               pair<DestIterator, DestAccessor> dest,
               double scale, GradValue gradient_threshold,
               DestValue edge_marker = NumericTraits<DestValue>::one())
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(w,h);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::differenceOfExponentialEdgeImage(srcImageRange(src), destImage(edges),
                                     0.8, 4.0, 1);

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    SrcAccessor::value_type u = src_accessor(src_upperleft);
    double d;
    GradValue gradient_threshold;

    u = u + u
    u = u - u
    u = u * u
    u = d * u
    u < gradient_threshold

    DestValue edge_marker;
    dest_accessor.set(edge_marker, dest_upperleft);

Preconditions:

    scale > 0
    gradient_threshold > 0

Definition at line 184 of file edgedetection.hxx.

References vigra_ext::destImage(), and vigra_ext::srcImageRange().

template<class Image1, class Image2, class BackInsertable>
void internalCannyFindEdgels Image1 const &  gx,
Image1 const &  gy,
Image2 const &  magnitude,
BackInsertable &  edgels,
std::vector< int >  p
 

Definition at line 1198 of file edgedetection.hxx.

References M_PI.

Referenced by APImage::_cannyEdgelList(), and vigra::cannyEdgelList().

template<class Image1, class Image2, class BackInsertable>
void internalCannyFindEdgels3x3 Image1 const &  grad,
Image2 const &  mask,
BackInsertable &  edgels
 

Definition at line 1975 of file edgedetection.hxx.

References M_PI, and hugin_utils::norm().

Referenced by vigra::cannyEdgelList3x3().

template<class Iterator, class Accessor, class Value>
void removeShortEdges triple< Iterator, Iterator, Accessor >  src,
unsigned int  min_edge_length,
Value  non_edge_marker
[inline]
 

Definition at line 790 of file edgedetection.hxx.

template<class Iterator, class Accessor, class Value>
void removeShortEdges Iterator  sul,
Iterator  slr,
Accessor  sa,
unsigned int  min_edge_length,
Value  non_edge_marker
 

Remove short edges from an edge image.

This algorithm can be applied as a post-processing operation of differenceOfExponentialEdgeImage() and differenceOfExponentialCrackEdgeImage(). It removes all edges that are shorter than min_edge_length. The corresponding pixels are set to the non_edge_marker. The idea behind this algorithms is that very short edges are probably caused by noise and don't represent interesting image structure. Technically, the algorithms executes a connected components labeling, so the image's value type must be equality comparable.

If the source image fulfills the requirements of a Crack Edge Image, it will still do so after application of this algorithm.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image. Also, the algorithm assumes that all non-edges pixels are already marked with the given non_edge_marker value.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class Iterator, class Accessor, class SrcValue>
        void removeShortEdges(
               Iterator sul, Iterator slr, Accessor sa,
               int min_edge_length, SrcValue non_edge_marker)
    }

use argument objects in conjunction with ArgumentObjectFactories:

    namespace vigra {
        template <class Iterator, class Accessor, class SrcValue>
        inline
        void removeShortEdges(
               triple<Iterator, Iterator, Accessor> src,
               int min_edge_length, SrcValue non_edge_marker)
    }

Usage:

#include "<a href="edgedetection_8hxx-source.html">vigra/edgedetection.hxx"
Namespace: vigra

    vigra::BImage src(w,h), edges(w,h);

    // empty edge image
    edges = 0;
    ...

    // find edges at scale 0.8 with gradient larger than 4.0, mark with 1
    vigra::differenceOfExponentialEdgeImage(srcImageRange(src), destImage(edges),
                                     0.8, 4.0, 1);

    // zero edges shorter than 10 pixels
    vigra::removeShortEdges(srcImageRange(edges), 10, 0);

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    SrcAccessor::value_type u = src_accessor(src_upperleft);

    u == u

    SrcValue non_edge_marker;
    src_accessor.set(non_edge_marker, src_upperleft);

Definition at line 749 of file edgedetection.hxx.

References vigra_ext::destImage(), vigra_ext::srcImage(), and vigra_ext::srcImageRange().


Generated on Mon Sep 9 01:25:51 2013 for Hugintrunk by  doxygen 1.3.9.1