Image Component Library (ICL)
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
icl::cv::CornerDetectorCSS Class Reference

Curvature Corner Detector. More...

#include <CornerDetectorCSS.h>

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

Classes

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, bool accurate=false)
 Default constructor with given arguments. More...
 
 ~CornerDetectorCSS ()
 Destructor. More...
 
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) More...
 
virtual std::vector< std::string > getPropertyList () const
 returns Configurable property list More...
 
virtual std::string getPropertyType (const std::string &propertyName) const
 returns type of given property More...
 
virtual std::string getPropertyInfo (const std::string &propertyName) const
 returns info for given property More...
 
virtual utils::Any getPropertyValue (const std::string &propertyName) const
 returns value for given property More...
 
virtual int getPropertyVolatileness (const std::string &propertyName) const
 returns volatileness for given property More...
 
virtual std::string getPropertyToolTip (const std::string &propertyName) const
 returns property descriptions More...
 
template<class T >
ICLCV_API const std::vector< std::vector< utils::Point32f > > & detectCorners (const std::vector< std::vector< T > > &boundaries, const std::vector< icl32f > &sigmas)
 detects the corners in the passed contour More...
 
template<class T >
ICLCV_API const std::vector< utils::Point32f > & detectCorners (const std::vector< T > &boundary)
 
const std::vector< utils::Point32f > & getLastCorners () const
 returns the result of last detectCorners call More...
 
void setAngleThreshold (float value)
 
void setRCCoeff (float value)
 
void setSigma (float value)
 
void setCurvatureCutoff (float value)
 
void setStraightLineThreshold (float value)
 
void setAccurate (bool value)
 
float getAngleThreshold () const
 
float getRCCoeff () const
 
float getSigma () const
 
float getCurvatureCutoff () const
 
float getStraightLineThreshold () const
 
bool getAccurate () const
 
- Public Member Functions inherited from icl::utils::Configurable
virtual ~Configurable ()
 virtual destructor More...
 
 Configurable (const Configurable &other)
 Copy constructor. More...
 
Configurableoperator= (const Configurable &other)
 Assignment operator. More...
 
void setConfigurableID (const std::string &ID) throw (ICLException)
 sets the ID of this configurable More...
 
const std::string & getConfigurableID () const
 returns the configurables static ID More...
 
bool isOrderedFlagSet () const
 returns whether the ordered flag is set More...
 
void deactivateProperty (const std::string &pattern)
 adds an additional deativation pattern More...
 
void deleteDeactivationPattern (const std::string &pattern)
 removed a formerly added deactivation pattern More...
 
std::vector< std::string > getPropertyListWithoutDeactivated () const
 this returns a filtered list of properties (using all filters added by deactivateProperty) More...
 
virtual void adaptProperty (const std::string &name, const std::string &newType, const std::string &newInfo, const std::string &newToolTip) throw (ICLException)
 this function can be used to adapt a specific property afterwards More...
 
void registerCallback (const Callback &cb)
 add a callback for changed properties More...
 
void removedCallback (const Callback &cb)
 removes a callback that was registered before More...
 
void syncChangesTo (Configurable *others, int num=1)
 this can be used to let this instance also apply property changes to others More...
 
virtual bool supportsProperty (const std::string &propertyName) const
 base implementation for property check (seaches in the property list) More...
 
virtual void saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) const
 writes all available properties into a file More...
 
virtual void loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC)
 reads a camera config file from disc More...
 

Static Public Member Functions

static int gaussian (GaussianKernel &gauss, float sigma, float cutoff)
 calculates a normalized 1d gaussian std::vector More...
 
static void convolute_1D (float *vec, int dim, float *kernel, int kernelDim, float *dst)
 Small wrapper for ippsConv_32f. More...
 
- Static Public Member Functions inherited from icl::utils::Configurable
static std::string create_default_ID (const std::string &prefix)
 this function can be used in subclasses to create a default ID More...
 
static Configurableget (const std::string &id)
 returns configurable by given ID More...
 
static void register_configurable_type (const std::string &classname, Function< Configurable * > creator) throw (ICLException)
 registers a configurable type More...
 
static std::vector< std::string > get_registered_configurables ()
 returns a list of all registered configurable classnames More...
 
static Configurablecreate_configurable (const std::string &classname) throw (ICLException)
 creates a configurable by given name More...
 

Private Member Functions

int gauss_radius (float sigma, float cutoff)
 
void fill_gauss (float *mask, float sigma, int width)
 
void convolute (const float *data, int data_length, const float *mask, int mask_length, float *convoluted)
 
void calculate_curvatures (const float *smoothed_x, const float *smoothed_y, int length, float curvature_cutoff, float *curvatures)
 
void calculate_curvatures_bulk (int array_length, int num_boundaries, const int *lengths, const int *indices, const int *indices_padded, const float *smoothed_x, const float *smoothed_y, float curvature_cutoff, float *curvature)
 
int findExtrema (int *extrema, int *num_extrema_out, float *k, int length)
 
void removeRoundCorners (float rc_coeff, int maxima_offset, float *k, int length, int *extrema, int num_extrema, int *new_extrema, int *num_new_extrema_out)
 
void removeRoundCornersAccurate (float rc_coeff, int maxima_offset, float *k, int length, int *extrema, int num_extrema, int *extrema_out, int *num_extrema_out)
 
float cornerAngle (float *x, float *y, int prev, int current, int next, int length, float straight_line_thresh)
 
float cornerAngleAccurate (float *x, float *y, int prev, int current, int next, int array_length, float straight_line_thresh)
 
void removeFalseCorners (float angle_thresh, float *x, float *y, float *k, int length, int *maxima, int num_maxima, int *maxima_out, int *num_maxima_out)
 

Private Attributes

float angle_thresh
 parameters More...
 
float rc_coeff
 
float sigma
 
float curvature_cutoff
 
float straight_line_thresh
 
bool accurate
 use acurate corner detection More...
 
std::vector< utils::Point32fcorners
 
std::vector< std::vector< utils::Point32f > > corners_list
 
CLCurvature * clcurvature
 
bool useOpenCL
 

Additional Inherited Members

- Public Types inherited from icl::utils::Configurable
typedef Function< void, const Property & > Callback
 Function type for changed properties. More...
 
- Static Public Attributes inherited from icl::utils::Configurable
static const std::vector< std::string > EMPTY_VEC
 used as shortcut – just an empty vector of std::strings More...
 
- Protected Member Functions inherited from icl::utils::Configurable
void addProperty (const std::string &name, const std::string &type, const std::string &info, const Any &value=Any(), const int volatileness=0, const std::string &tooltip=std::string()) throw (ICLException)
 This can be used by derived classes to store supported properties in the internal list. More...
 
void addChildConfigurable (Configurable *configurable, const std::string &childPrefix="")
 This adds another configurable as child. More...
 
void removeChildConfigurable (Configurable *configurable)
 removes the given child configurable More...
 
Propertyprop (const std::string &propertyName) throw (ICLException)
 this CAN be used e.g. to store a property value in internal property-list More...
 
const Propertyprop (const std::string &propertyName) const throw (ICLException)
 this CAN be used e.g. to store a property value in internal property-list More...
 
 Configurable (const std::string &ID="", bool ordered=true) throw (ICLException)
 create this configurable with given ID More...
 
void call_callbacks (const std::string &propertyName, const Configurable *caller) const
 calls all registered callbacks More...
 
- Protected Member Functions inherited from icl::utils::Uncopyable
 Uncopyable ()
 Empty base constructor. More...
 
- Protected Attributes inherited from icl::utils::Configurable
std::vector< Callbackcallbacks
 internally managed list of callbacks More...
 

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:

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,
bool  accurate = false 
)

Default constructor with given arguments.

icl::cv::CornerDetectorCSS::~CornerDetectorCSS ( )

Destructor.

Member Function Documentation

void icl::cv::CornerDetectorCSS::calculate_curvatures ( const float *  smoothed_x,
const float *  smoothed_y,
int  length,
float  curvature_cutoff,
float *  curvatures 
)
private
void icl::cv::CornerDetectorCSS::calculate_curvatures_bulk ( int  array_length,
int  num_boundaries,
const int *  lengths,
const int *  indices,
const int *  indices_padded,
const float *  smoothed_x,
const float *  smoothed_y,
float  curvature_cutoff,
float *  curvature 
)
private
void icl::cv::CornerDetectorCSS::convolute ( const float *  data,
int  data_length,
const float *  mask,
int  mask_length,
float *  convoluted 
)
private
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 \form#143

 with \form#144 for \form#145
 and \form#146 for \form#147
float icl::cv::CornerDetectorCSS::cornerAngle ( float *  x,
float *  y,
int  prev,
int  current,
int  next,
int  length,
float  straight_line_thresh 
)
private
float icl::cv::CornerDetectorCSS::cornerAngleAccurate ( float *  x,
float *  y,
int  prev,
int  current,
int  next,
int  array_length,
float  straight_line_thresh 
)
private
template<class T >
ICLCV_API const std::vector<std::vector<utils::Point32f> >& icl::cv::CornerDetectorCSS::detectCorners ( const std::vector< std::vector< T > > &  boundaries,
const std::vector< icl32f > &  sigmas 
)

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
template<class T >
ICLCV_API const std::vector<utils::Point32f>& icl::cv::CornerDetectorCSS::detectCorners ( const std::vector< T > &  boundary)
void icl::cv::CornerDetectorCSS::fill_gauss ( float *  mask,
float  sigma,
int  width 
)
private
int icl::cv::CornerDetectorCSS::findExtrema ( int *  extrema,
int *  num_extrema_out,
float *  k,
int  length 
)
private
int icl::cv::CornerDetectorCSS::gauss_radius ( float  sigma,
float  cutoff 
)
private
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
bool icl::cv::CornerDetectorCSS::getAccurate ( ) const
inline
float icl::cv::CornerDetectorCSS::getAngleThreshold ( ) const
inline
float icl::cv::CornerDetectorCSS::getCurvatureCutoff ( ) const
inline
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
inlinevirtual

returns volatileness for given property

Reimplemented from icl::utils::Configurable.

float icl::cv::CornerDetectorCSS::getRCCoeff ( ) const
inline
float icl::cv::CornerDetectorCSS::getSigma ( ) const
inline
float icl::cv::CornerDetectorCSS::getStraightLineThreshold ( ) const
inline
void icl::cv::CornerDetectorCSS::removeFalseCorners ( float  angle_thresh,
float *  x,
float *  y,
float *  k,
int  length,
int *  maxima,
int  num_maxima,
int *  maxima_out,
int *  num_maxima_out 
)
private
void icl::cv::CornerDetectorCSS::removeRoundCorners ( float  rc_coeff,
int  maxima_offset,
float *  k,
int  length,
int *  extrema,
int  num_extrema,
int *  new_extrema,
int *  num_new_extrema_out 
)
private
void icl::cv::CornerDetectorCSS::removeRoundCornersAccurate ( float  rc_coeff,
int  maxima_offset,
float *  k,
int  length,
int *  extrema,
int  num_extrema,
int *  extrema_out,
int *  num_extrema_out 
)
private
void icl::cv::CornerDetectorCSS::setAccurate ( bool  value)
inline
void icl::cv::CornerDetectorCSS::setAngleThreshold ( float  value)
inline
void icl::cv::CornerDetectorCSS::setCurvatureCutoff ( float  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
void icl::cv::CornerDetectorCSS::setStraightLineThreshold ( float  value)
inline

Member Data Documentation

bool icl::cv::CornerDetectorCSS::accurate
private

use acurate corner detection

float icl::cv::CornerDetectorCSS::angle_thresh
private

parameters

CLCurvature* icl::cv::CornerDetectorCSS::clcurvature
private
std::vector<utils::Point32f> icl::cv::CornerDetectorCSS::corners
private
std::vector<std::vector<utils::Point32f> > icl::cv::CornerDetectorCSS::corners_list
private
float icl::cv::CornerDetectorCSS::curvature_cutoff
private
float icl::cv::CornerDetectorCSS::rc_coeff
private
float icl::cv::CornerDetectorCSS::sigma
private
float icl::cv::CornerDetectorCSS::straight_line_thresh
private
bool icl::cv::CornerDetectorCSS::useOpenCL
private

The documentation for this class was generated from the following file: