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

Curvature Corner Detector. More...

#include <CornerDetectorCSS.h>

Inheritance diagram for icl::cv::CornerDetectorCSS:
icl::utils::Configurable

List of all members.

Classes

struct  DebugInformation
 Detailed information about one corner detection run. More...
struct  GaussianKernel
 1 dim gaussian kernel More...

Public Member Functions

 CornerDetectorCSS (float angle_thresh=162., float rc_coeff=1.5, float sigma=3., float curvature_cutoff=100., float straight_line_thresh=0.1)
 Default constructor with given arguments.
virtual void setPropertyValue (const std::string &propertyName, const utils::Any &value) throw (utils::ICLException)
 sets value of a property (always call call_callbacks(propertyName) or Configurable::setPropertyValue)
virtual std::vector< std::string > getPropertyList () const
 returns Configurable property list
virtual std::string getPropertyType (const std::string &propertyName) const
 returns type of given property
virtual std::string getPropertyInfo (const std::string &propertyName) const
 returns info for given property
virtual utils::Any getPropertyValue (const std::string &propertyName) const
 returns value for given property
virtual int getPropertyVolatileness (const std::string &propertyName) const
 returns volatileness for given property
virtual std::string getPropertyToolTip (const std::string &propertyName) const
 returns property descriptions
const std::vector
< utils::Point32f > & 
detectCorners (const std::vector< utils::Point32f > &boundary)
 detects the corners in the passed contour
const std::vector
< utils::Point32f > & 
detectCorners (const std::vector< utils::Point > &boundary)
 detects corners on int-points
const std::vector
< utils::Point32f > & 
getLastCorners () const
 returns the result of last detectCorners call
const std::vector< float > & getCornerAngles () const
 Returns approximated angles of corners in deg. Call detectCorners method first.
void setAngleThreshold (float value)
void setRCCoeff (float value)
void setSigma (float value)
void setCurvatureCutoff (float value)
void setStraightLineThreshold (float value)
float getAngleThreshold () const
float getRCCoeff () const
float getSigma () const
float getCurvatureCutoff () const
float getStraightLineThreshold () const
void setDebugMode (bool value)
const DebugInformationgetDebugInformation () const throw (utils::ICLException)

Static Public Member Functions

static int gaussian (GaussianKernel &gauss, float sigma, float cutoff)
 calculates a normalized 1d gaussian std::vector
static void convolute_1D (float *vec, int dim, float *kernel, int kernelDim, float *dst)
 Small wrapper for ippsConv_32f.

Static Private Member Functions

static void findExtrema (std::vector< int > &extrema, icl32f *x, int length)
 finds the indicies of extrema
static void removeRoundCorners (float rc_coeff, icl32f *k, std::vector< int > &extrema)
 removes round corners by comparing all corner candidates with adaptive local threshold
static void removeFalseCorners (float angle_thresh, icl32f *xx, icl32f *yy, icl32f *k, int length, std::vector< int > &maxima, std::vector< float > &corner_angles, float straight_line_thresh)
 remove false corners by checking the corner angle
static float tangentAngle (icl32f *x, icl32f *y, int length, int center, float straight_line_thresh)
 estimates the angle of a corner

Private Attributes

float angle_thresh
 parameters
float rc_coeff
float sigma
float curvature_cutoff
float straight_line_thresh
bool debug_mode
 debug mode flag
GaussianKernel m_gauss
 gausian kernel
std::vector< utils::Point32fcorners
std::vector< float > corner_angles
std::vector< int > extrema
std::vector< utils::Point32finputBuffer
DebugInformation debug_inf

Detailed Description

Curvature Corner Detector.

Implementation of the Curvature Scale Space corner detection algorithm described in the paper "Corner detector based on global and local curvature properties", by Chen He, Xiao and Yung, Nelson H.C. in Optical Engineering 2008. There also is a Matlab implementation of the algorithm by Chen He, Xiao available at http://www.mathworks.com/matlabcentral/fileexchange/7652

The algorithm takes an array of contour points as input, that are then smoothed by a gaussian filter. Afterwards the curvature function is calculated and its maxima positions are taken as corner candidates. Afterwards all candidates which belong to round or "false" (noise induced, etc.) corners are removed and finally a list of corners is given back.

Parameters for the algorithm are:

Diffent to the reference implementation of Xiao He, the second half of the contour is copied before the start of the contour and the first half of the contour is copied behind the end of the contour. That way, the (artificially) first and last corners in the closed contour are calculated more acurately, since there are no discontinuities.

For visualizing the algorithm, you can call setDebugMode(true) after construction of the CornerDetectionCSS object and retrieve detailed information of the detection process afterwards with the getDebugInformation() method. See the icl-corner-detection-css-demo as an example.

usage example:

        const std::vector<icl::Region> &rs = d.detect(&image);
        const std::vector<Point32f> &boundary = getThinnedBoundary(rs[0].getBoundary());
        CornerDetectorCSS css;
        const std::vector<Point32f> &corners = css.detectCorners(boundary);

Constructor & Destructor Documentation

icl::cv::CornerDetectorCSS::CornerDetectorCSS ( float  angle_thresh = 162.,
float  rc_coeff = 1.5,
float  sigma = 3.,
float  curvature_cutoff = 100.,
float  straight_line_thresh = 0.1 
) [inline]

Default constructor with given arguments.


Member Function Documentation

static void icl::cv::CornerDetectorCSS::convolute_1D ( float *  vec,
int  dim,
float *  kernel,
int  kernelDim,
float *  dst 
) [static]

Small wrapper for ippsConv_32f.

Parameters:
vec
dim
kernel
kernelDim
dstdestination data pointer of size dim+kernelDim -1

Performs the following operation

\[ \mbox{dst}[n] = \sum\limits_{k=0}^n \mbox{src}[k] \cdot \mbox{kernel}[n-k] \]

for all $ n \in [0,\mbox{dim}+\mbox{kernelDim}-1]$

with $ \mbox{src}[x] = 0 $ for $ x \not\in [0,\mbox{dim}-1] $ and $ \mbox{kernel}[x] = 0$ for $ x \not\in [0,\mbox{kernelDim}-1] $

const std::vector<utils::Point32f>& icl::cv::CornerDetectorCSS::detectCorners ( const std::vector< utils::Point32f > &  boundary)

detects the corners in the passed contour

Use this function to detect the corners in an image.
A reference to the contour in which the corners should be detected must be passed. The contour should be "thinned", meaning that it should look e.g. like

          ooox                ooxx
          ooxo  and not like  oxxo
          oxoo                xxoo
          xooo                xooo
          
const std::vector<utils::Point32f>& icl::cv::CornerDetectorCSS::detectCorners ( const std::vector< utils::Point > &  boundary)

detects corners on int-points

static void icl::cv::CornerDetectorCSS::findExtrema ( std::vector< int > &  extrema,
icl32f x,
int  length 
) [static, private]

finds the indicies of extrema

Parameters:
extremareference to a std::vector in which the extrema are stored
xfunction values
lengthnumber of points in array x
static int icl::cv::CornerDetectorCSS::gaussian ( GaussianKernel gauss,
float  sigma,
float  cutoff 
) [static]

calculates a normalized 1d gaussian std::vector

Parameters:
gaussreference to GaussianKernel struct
sigmasigma^2 is the variance of the gaussian, default is 1
cutoffif value of gaussian drops below this value, it is set to zero, default is 0.001
Returns:
width of the gaussian tails, so the size of the returned std::vector is 2*width+1
const std::vector<float>& icl::cv::CornerDetectorCSS::getCornerAngles ( ) const [inline]

Returns approximated angles of corners in deg. Call detectCorners method first.

const std::vector<utils::Point32f>& icl::cv::CornerDetectorCSS::getLastCorners ( ) const [inline]

returns the result of last detectCorners call

This function can be used as optimization e.g. whithin ICLCV::Region implementation

virtual std::string icl::cv::CornerDetectorCSS::getPropertyInfo ( const std::string &  propertyName) const [virtual]

returns info for given property

Reimplemented from icl::utils::Configurable.

virtual std::vector<std::string> icl::cv::CornerDetectorCSS::getPropertyList ( ) const [virtual]

returns Configurable property list

Reimplemented from icl::utils::Configurable.

virtual std::string icl::cv::CornerDetectorCSS::getPropertyToolTip ( const std::string &  propertyName) const [virtual]

returns property descriptions

Reimplemented from icl::utils::Configurable.

virtual std::string icl::cv::CornerDetectorCSS::getPropertyType ( const std::string &  propertyName) const [virtual]

returns type of given property

Reimplemented from icl::utils::Configurable.

virtual utils::Any icl::cv::CornerDetectorCSS::getPropertyValue ( const std::string &  propertyName) const [virtual]

returns value for given property

Reimplemented from icl::utils::Configurable.

virtual int icl::cv::CornerDetectorCSS::getPropertyVolatileness ( const std::string &  propertyName) const [inline, virtual]

returns volatileness for given property

Reimplemented from icl::utils::Configurable.

float icl::cv::CornerDetectorCSS::getRCCoeff ( ) const [inline]
float icl::cv::CornerDetectorCSS::getSigma ( ) const [inline]
static void icl::cv::CornerDetectorCSS::removeFalseCorners ( float  angle_thresh,
icl32f xx,
icl32f yy,
icl32f k,
int  length,
std::vector< int > &  maxima,
std::vector< float > &  corner_angles,
float  straight_line_thresh 
) [static, private]

remove false corners by checking the corner angle

The angle threshold denotes the maximum obtuse angle that a corner can have when it is detected as a true corner.

Parameters:
angle_threshangle threshold
xx,yyx,y dimension of smoothed contour
kcurvature function
lengthnumber of points in smoothed contour (and curvature function)
maximaindicies of maximum points in curvature function k
corner_angles
straight_line_thresh
static void icl::cv::CornerDetectorCSS::removeRoundCorners ( float  rc_coeff,
icl32f k,
std::vector< int > &  extrema 
) [static, private]

removes round corners by comparing all corner candidates with adaptive local threshold

The round corner coefficient denotes the minimum ratio of major axis to minor axis of an ellipse, whose vertex could be detected as a corner by proposed detector.

Parameters:
rc_coeffround corner coefficient
kcurvature function
extremaindicies of extrem points in curvature function k
void icl::cv::CornerDetectorCSS::setAngleThreshold ( float  value) [inline]
void icl::cv::CornerDetectorCSS::setCurvatureCutoff ( float  value) [inline]
void icl::cv::CornerDetectorCSS::setDebugMode ( bool  value) [inline]
virtual void icl::cv::CornerDetectorCSS::setPropertyValue ( const std::string &  propertyName,
const utils::Any value 
) throw (utils::ICLException) [virtual]

sets value of a property (always call call_callbacks(propertyName) or Configurable::setPropertyValue)

Reimplemented from icl::utils::Configurable.

void icl::cv::CornerDetectorCSS::setRCCoeff ( float  value) [inline]
void icl::cv::CornerDetectorCSS::setSigma ( float  value) [inline]
static float icl::cv::CornerDetectorCSS::tangentAngle ( icl32f x,
icl32f y,
int  length,
int  center,
float  straight_line_thresh 
) [static, private]

estimates the angle of a corner

Eestimates the angle of a corner in a part of the curve by fitting a circle on each side of the corner and calculating the angle between the two tangents.

Parameters:
x,yx,y dimension of the contour segment around the corner
lengthnumber of points in contour segment
centerposition of corner in contour segment
straight_line_thresh

Member Data Documentation

parameters

std::vector<float> icl::cv::CornerDetectorCSS::corner_angles [private]

debug mode flag

std::vector<int> icl::cv::CornerDetectorCSS::extrema [private]

gausian kernel


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