Image Component Library (ICL)
|
Curvature Corner Detector. More...
#include <CornerDetectorCSS.h>
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. | |
~CornerDetectorCSS () | |
Destructor. | |
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 | |
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 | |
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 | |
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 |
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. | |
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 | |
float | rc_coeff |
float | sigma |
float | curvature_cutoff |
float | straight_line_thresh |
bool | accurate |
use acurate corner detection | |
std::vector< utils::Point32f > | corners |
std::vector< std::vector < utils::Point32f > > | corners_list |
CLCurvature * | clcurvature |
bool | useOpenCL |
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.
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);
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.
Destructor.
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.
vec | |
dim | |
kernel | |
kernelDim | |
dst | destination data pointer of size dim+kernelDim -1 |
Performs the following operation
for all
with for and for
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] |
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
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
gauss | reference to GaussianKernel struct |
sigma | sigma^2 is the variance of the gaussian, default is 1 |
cutoff | if value of gaussian drops below this value, it is set to zero, default is 0.001 |
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 [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] |
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] |
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] |