Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
icl::filter::CannyOp Class Reference

Class for the canny edge detector. More...

#include <CannyOp.h>

Inheritance diagram for icl::filter::CannyOp:
icl::filter::UnaryOp icl::utils::Uncopyable icl::utils::Configurable

List of all members.

Public Member Functions

 CannyOp (icl32f lowThresh=0, icl32f highThresh=255, int preBlurRadius=0)
 Constructor.
 CannyOp (UnaryOp *dxOp, UnaryOp *dyOp, icl32f lowThresh=0, icl32f highThresh=255, bool deleteOps=true, int preBlurRadius=0)
 Constructor.
virtual ~CannyOp ()
 Destructor.
void setThresholds (icl32f lowThresh, icl32f highThresh)
 changes the Thresholds
icl32f getLowThreshold () const
 returns the lower threshold
icl32f getHighThreshold () const
 returns the upper threshold
virtual void apply (const core::ImgBase *src, core::ImgBase **dst)
 applies the Canny Operator
void setPreBlurRadius (int preBlurRadius)
 sets the pre-blur-radius
bool getPreBlurRadius () const
 returns current pre-blur feature state

Private Member Functions

void setUpPreBlurOp ()
void applyCanny32f (const core::ImgBase *dx, const core::ImgBase *dy, core::ImgBase *dst, int c)
 applies canny for one channel
void applyCanny16s (const core::ImgBase *dx, const core::ImgBase *dy, core::ImgBase *dst, int c)

Private Attributes

std::vector< icl8um_cannyBuf
 buffer for ippiCanny
core::ImgBasem_derivatives [2]
UnaryOpm_ops [2]
UnaryOpm_preBlurOp
icl32f m_lowT
icl32f m_highT
bool m_ownOps
core::Img32f m_buffer
int m_preBlurRadius

Detailed Description

Class for the canny edge detector.

Overview

The canny edge detector detects image borders from gray-scale images. It's result is an Img8u binary image containing thin borders.

Algorithm

The canny edge detector is a very common filter for edge detection, therefore it is already implemented in the IPP. The algorithm can be split into 3 major parts:

  1. Image differentiation here, image x and y gradients are computed. Commonly this is done using sobel- X and -Y filters.
  2. Non-Maximum suppression The image differentiation result is converted into an image intensity map and into a gradient direction map. Now all pixels are suppressed, that are not ridges in gradient intensity map mountain.
  3. Thresholding Here a special threshold operation is used. Two threshold values (l=low threshold and h=high threshold) split the edge intensity scale into 3 parts:
    1. below the lower threshold pixels with such values are in any case no border pixels
    2. above the upper threshold these pixels are border pixels
    3. in the middle section these pixels are only border pixels if there's a connected chain of other pixels (each also in the middle section) that is connected in any way to a border pixel.

(please see IPP's canny edge detector documentation for more detail)

pre-blur features

In some cases (e.g. if input images are created synthetically) the border intensity image has too hard edges (e.g. from edges from black to white). In this case, the canny edge detector implementation overlooks these borders independent on the given threshold values.


Constructor & Destructor Documentation

icl::filter::CannyOp::CannyOp ( icl32f  lowThresh = 0,
icl32f  highThresh = 255,
int  preBlurRadius = 0 
)

Constructor.

With this Constructor the derivations are computed within the CannyOp. If you already have computed the derivations, use the other Constructor, due to performance reasons.

Parameters:
lowThreshlower threshold
highThreshupper threshold
preBlurRadiusif r> 0, gaussian kernel with masksize r*2+1 is applied to the input image first
icl::filter::CannyOp::CannyOp ( UnaryOp dxOp,
UnaryOp dyOp,
icl32f  lowThresh = 0,
icl32f  highThresh = 255,
bool  deleteOps = true,
int  preBlurRadius = 0 
)

Constructor.

Parameters:
dxOpthe x derivation of the src
dyOpthe y derivation of the src
lowThreshlower threshold
highThreshupper threshold
deleteOpsshould the internaly created derivations be deleted?
preBlurRadiusif r> 0, gaussian kernel with masksize r*2+1 is applied to the input image first
virtual icl::filter::CannyOp::~CannyOp ( ) [virtual]

Destructor.


Member Function Documentation

virtual void icl::filter::CannyOp::apply ( const core::ImgBase src,
core::ImgBase **  dst 
) [virtual]

applies the Canny Operator

Parameters:
srcthe source image
dstpointer to the destination image

Implements icl::filter::UnaryOp.

void icl::filter::CannyOp::applyCanny16s ( const core::ImgBase dx,
const core::ImgBase dy,
core::ImgBase dst,
int  c 
) [private]
void icl::filter::CannyOp::applyCanny32f ( const core::ImgBase dx,
const core::ImgBase dy,
core::ImgBase dst,
int  c 
) [private]

applies canny for one channel

returns the upper threshold

Returns:
the upper threshold

returns the lower threshold

Returns:
the lower threshold
bool icl::filter::CannyOp::getPreBlurRadius ( ) const [inline]

returns current pre-blur feature state

void icl::filter::CannyOp::setPreBlurRadius ( int  preBlurRadius) [inline]

sets the pre-blur-radius

if r> 0, gaussian kernel with masksize r*2+1 is applied to the input image first

void icl::filter::CannyOp::setThresholds ( icl32f  lowThresh,
icl32f  highThresh 
)

changes the Thresholds

Parameters:
lowThreshlower threshold
highThreshupper threshold

Member Data Documentation

std::vector<icl8u> icl::filter::CannyOp::m_cannyBuf [private]

buffer for ippiCanny


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines