Main MRPT website > C++ reference for MRPT 1.5.7
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions
mrpt::vision::CFeatureExtraction Class Reference

Detailed Description

The central class from which images can be analyzed in search of different kinds of interest points and descriptors computed for them.

To extract features from an image, create an instance of CFeatureExtraction, fill out its CFeatureExtraction::options field, including the algorithm to use (see CFeatureExtraction::TOptions::featsType), and call CFeatureExtraction::detectFeatures. This will return a set of features of the class mrpt::vision::CFeature, which include details for each interest point as well as the desired descriptors and/or patches.

By default, a 21x21 patch is extracted for each detected feature. If the patch is not needed, set patchSize to 0 in CFeatureExtraction::options

The implemented detection algorithms are (see CFeatureExtraction::TOptions::featsType):

Additionally, given a list of interest points onto an image, the following descriptors can be computed for each point by calling CFeatureExtraction::computeDescriptors :

Apart from the normal entry point detectFeatures(), these other low-level static methods are provided for convenience:

Note
The descriptor "Intensity-domain spin images" is described in "A sparse texture representation using affine-invariant regions", S Lazebnik, C Schmid, J Ponce, 2003 IEEE Computer Society Conference on Computer Vision.
See also
mrpt::vision::CFeature

Definition at line 59 of file CFeatureExtraction.h.

#include <mrpt/vision/CFeatureExtraction.h>

Classes

struct  TOptions
 The set of parameters for all the detectors & descriptor algorithms. More...
 

Public Types

enum  TSIFTImplementation {
  LoweBinary = 0, CSBinary, VedaldiBinary, Hess,
  OpenCV
}
 

Public Member Functions

 CFeatureExtraction ()
 Constructor. More...
 
virtual ~CFeatureExtraction ()
 Virtual destructor. More...
 
void detectFeatures (const mrpt::utils::CImage &img, CFeatureList &feats, const unsigned int init_ID=0, const unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the method defined in TOptions. More...
 
void computeDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &inout_features, TDescriptorType in_descriptor_list) const
 Compute one (or more) descriptors for the given set of interest points onto the image, which may have been filled out manually or from detectFeatures. More...
 

Static Public Member Functions

Static methods with low-level detector functionality
static void detectFeatures_SSE2_FASTER9 (const mrpt::utils::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=NULL)
 A SSE2-optimized implementation of FASTER-9 (requires img to be grayscale). More...
 
static void detectFeatures_SSE2_FASTER10 (const mrpt::utils::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=NULL)
 Just like detectFeatures_SSE2_FASTER9() for another version of the detector. More...
 
static void detectFeatures_SSE2_FASTER12 (const mrpt::utils::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=NULL)
 Just like detectFeatures_SSE2_FASTER9() for another version of the detector. More...
 

Public Attributes

TOptions options
 Set all the parameters of the desired method here before calling "detectFeatures". More...
 

Private Member Functions

void internal_computeSiftDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute the SIFT descriptor of the provided features into the input image. More...
 
void internal_computeSurfDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute the SURF descriptor of the provided features into the input image. More...
 
void internal_computeORBDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute the ORB descriptor of the provided features into the input image. More...
 
void internal_computeSpinImageDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute the intensity-domain spin images descriptor of the provided features into the input image. More...
 
void internal_computePolarImageDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute a polar-image descriptor of the provided features into the input image. More...
 
void internal_computeLogPolarImageDescriptors (const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
 Compute a log-polar image descriptor of the provided features into the input image. More...
 
void extractFeaturesKLT (const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the KLT method. More...
 
void extractFeaturesBCD (const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the BCD method. More...
 
void extractFeaturesSIFT (const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the SIFT method. More...
 
void extractFeaturesORB (const mrpt::utils::CImage &img, CFeatureList &feats, const unsigned int init_ID=0, const unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the ORB method. More...
 
void extractFeaturesSURF (const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Extract features from the image based on the SURF method. More...
 
void extractFeaturesFAST (const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI(), const mrpt::math::CMatrixBool *mask=NULL) const
 Extract features from the image based on the FAST method. More...
 
void extractFeaturesFASTER_N (const int N, const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
 Edward's "FASTER & Better" detector, N=9,10,12. More...
 
voidmy_scale_space_extrema (CFeatureList &featList, void *dog_pyr, int octvs, int intvls, double contr_thr, int curv_thr, void *storage) const
 Computes extrema in the scale space. More...
 
void my_adjust_for_img_dbl (void *features) const
 Adjust scale if the image was initially doubled. More...
 
void getTimesExtrema (void *dog_pyr, int octvs, int intvls, float row, float col, unsigned int &nMin, unsigned int &nMax) const
 Gets the number of times that a point in the image is higher or lower than the surroundings in the image-scale space. More...
 
double getLaplacianValue (void *dog_pyr, int octvs, int intvls, float row, float col) const
 Computes the Laplacian value of the feature in the corresponing image in the pyramid. More...
 
void insertCvSeqInCFeatureList (void *features, CFeatureList &list, unsigned int init_ID=0) const
 Append a sequence of openCV features into an MRPT feature list. More...
 
void convertCvSeqInCFeatureList (void *features, CFeatureList &list, unsigned int init_ID=0, const TImageROI &ROI=TImageROI()) const
 Converts a sequence of openCV features into an MRPT feature list. More...
 

Member Enumeration Documentation

Enumerator
LoweBinary 
CSBinary 
VedaldiBinary 
Hess 
OpenCV 

Definition at line 62 of file CFeatureExtraction.h.

Constructor & Destructor Documentation

CFeatureExtraction::CFeatureExtraction ( )

Constructor.

Definition at line 26 of file CFeatureExtraction_common.cpp.

CFeatureExtraction::~CFeatureExtraction ( )
virtual

Virtual destructor.

Definition at line 33 of file CFeatureExtraction_common.cpp.

Member Function Documentation

void CFeatureExtraction::computeDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList inout_features,
TDescriptorType  in_descriptor_list 
) const

Compute one (or more) descriptors for the given set of interest points onto the image, which may have been filled out manually or from detectFeatures.

Parameters
in_img(input) The image from where to compute the descriptors.
inout_features(input/output) The list of features whose descriptors are going to be computed.
in_descriptor_list(input) The bitwise OR of one or several descriptors defined in TDescriptorType.

Each value in "in_descriptor_list" represents one descriptor to be computed, for example:

// This call will compute both, SIFT and Spin-Image descriptors for a list of feature points lstFeats.
fext.computeDescriptors(img, lstFeats, descSIFT | descSpinImages );
Note
The SIFT descriptors for already located features can only be computed through the Hess and CSBinary implementations which may be specified in CFeatureExtraction::TOptions::SIFTOptions.
This call will also use additional parameters from options

Definition at line 208 of file CFeatureExtraction_common.cpp.

References mrpt::vision::descLogPolarImages, mrpt::vision::descORB, mrpt::vision::descPolarImages, mrpt::vision::descSIFT, mrpt::vision::descSpinImages, mrpt::vision::descSURF, MRPT_END, MRPT_START, and THROW_EXCEPTION_FMT.

Referenced by mrpt::slam::COccupancyGridMapFeatureExtractor::uncached_extractFeatures().

void CFeatureExtraction::convertCvSeqInCFeatureList ( void features,
CFeatureList list,
unsigned int  init_ID = 0,
const TImageROI ROI = TImageROI() 
) const
private

Converts a sequence of openCV features into an MRPT feature list.

Parameters
featuresThe sequence of features.
list[in-out] The list of MRPT features.
init_ID[in][optional] The initial ID for the features (default = 0).
ROI[in][optional] The initial ID for the features (default = empty ROI -> not used).

Definition at line 670 of file CFeatureExtraction_SIFT.cpp.

References ASSERT_, mrpt::vision::CFeatureList::clear(), mrpt::vision::CFeature::Create(), feature::d, feature::descr, mrpt::vision::featSIFT, feature::ori, mrpt::vision::CFeatureList::push_back(), feature::scl, THROW_EXCEPTION, feature::x, mrpt::vision::TImageROI::xMax, mrpt::vision::TImageROI::xMin, feature::y, mrpt::vision::TImageROI::yMax, and mrpt::vision::TImageROI::yMin.

void CFeatureExtraction::detectFeatures ( const mrpt::utils::CImage img,
CFeatureList feats,
const unsigned int  init_ID = 0,
const unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
void CFeatureExtraction::extractFeaturesBCD ( const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private

Extract features from the image based on the BCD method.

Parameters
imgThe image from where to extract the images.
featsThe list of extracted features.
nDesiredFeaturesNumber of features to be extracted. Default: authomatic.
ROI(op. input) Region of Interest. Default: All the image.

Definition at line 257 of file CFeatureExtraction_common.cpp.

References MRPT_UNUSED_PARAM, and THROW_EXCEPTION.

void CFeatureExtraction::extractFeaturesFAST ( const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI(),
const mrpt::math::CMatrixBool mask = NULL 
) const
private
void CFeatureExtraction::extractFeaturesFASTER_N ( const int  N,
const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private
void CFeatureExtraction::extractFeaturesKLT ( const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private
void CFeatureExtraction::extractFeaturesORB ( const mrpt::utils::CImage img,
CFeatureList feats,
const unsigned int  init_ID = 0,
const unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private
void CFeatureExtraction::extractFeaturesSIFT ( const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private
void CFeatureExtraction::extractFeaturesSURF ( const mrpt::utils::CImage img,
CFeatureList feats,
unsigned int  init_ID = 0,
unsigned int  nDesiredFeatures = 0,
const TImageROI ROI = TImageROI() 
) const
private

Extract features from the image based on the SURF method.

Parameters
imgThe image from where to extract the images.
featsThe list of extracted features.
nDesiredFeaturesNumber of features to be extracted. Default: authomatic.

Definition at line 45 of file CFeatureExtraction_SURF.cpp.

References mrpt::vision::CFeatureList::clear(), mrpt::vision::CFeature::Create(), mrpt::utils::CImage::extract_patch(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::vision::featSURF, mrpt::utils::CImage::getAs(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getWidth(), int(), min, mrpt::vision::CFeatureList::push_back(), mrpt::utils::round(), and THROW_EXCEPTION.

double CFeatureExtraction::getLaplacianValue ( void dog_pyr,
int  octvs,
int  intvls,
float  row,
float  col 
) const
private

Computes the Laplacian value of the feature in the corresponing image in the pyramid.

Parameters
dog_pyrPyramid of images.
octvsNumber of considered octaves.
intvlsNumber of intervales in octaves.
rowThe row of the feature in the original image.
colThe column of the feature in the original image.

Definition at line 847 of file CFeatureExtraction_SIFT.cpp.

References pixval32f(), and THROW_EXCEPTION.

void CFeatureExtraction::getTimesExtrema ( void dog_pyr,
int  octvs,
int  intvls,
float  row,
float  col,
unsigned int nMin,
unsigned int nMax 
) const
private

Gets the number of times that a point in the image is higher or lower than the surroundings in the image-scale space.

Parameters
dog_pyrPyramid of images.
octvsNumber of considered octaves.
intvlsNumber of intervales in octaves.
rowThe row of the feature in the original image.
colThe column of the feature in the original image.
nMin[out]: Times that the feature is lower than the surroundings.
nMax[out]: Times that the feature is higher than the surroundings.

Definition at line 876 of file CFeatureExtraction_SIFT.cpp.

References pixval32f(), and THROW_EXCEPTION.

void CFeatureExtraction::insertCvSeqInCFeatureList ( void features,
CFeatureList list,
unsigned int  init_ID = 0 
) const
private

Append a sequence of openCV features into an MRPT feature list.

Parameters
featuresThe sequence of features.
list[in-out] The list of MRPT features.
init_ID[in] The initial ID for the new features.

Definition at line 708 of file CFeatureExtraction_SIFT.cpp.

References ASSERT_, mrpt::vision::CFeatureList::begin(), feature::d, feature::descr, mrpt::vision::CFeatureList::end(), feature::ori, feature::scl, THROW_EXCEPTION, feature::x, and feature::y.

void CFeatureExtraction::internal_computeLogPolarImageDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute a log-polar image descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.
Note
Additional parameters from CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this method.

Definition at line 27 of file CFeatureExtraction_logPolarImg.cpp.

References ASSERT_, mrpt::vision::CFeatureList::begin(), mrpt::vision::CFeatureList::end(), mrpt::utils::CImage::getAs(), mrpt::utils::CImage::getChannelCount(), MRPT_END, MRPT_START, and THROW_EXCEPTION.

void CFeatureExtraction::internal_computeORBDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute the ORB descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.

Definition at line 209 of file CFeatureExtraction_ORB.cpp.

References mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::utils::CImage::getAs(), mrpt::vision::CFeatureList::resize(), mrpt::vision::CFeatureList::size(), and THROW_EXCEPTION.

void CFeatureExtraction::internal_computePolarImageDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute a polar-image descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.
Note
Additional parameters from CFeatureExtraction::TOptions::PolarImagesOptions are used in this method.

Definition at line 133 of file CFeatureExtraction_polarImg.cpp.

References ASSERT_, mrpt::vision::CFeatureList::begin(), mrpt::vision::CFeatureList::end(), mrpt::utils::CImage::getAs(), mrpt::utils::CImage::getChannelCount(), MRPT_END, MRPT_START, my_cvLinearPolar(), and THROW_EXCEPTION.

void CFeatureExtraction::internal_computeSiftDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute the SIFT descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.
Note
The SIFT descriptors for already located features can only be computed through the Hess and CSBinary implementations which may be specified in CFeatureExtraction::TOptions::SIFTOptions.

Definition at line 494 of file CFeatureExtraction_SIFT.cpp.

References ASSERT_, mrpt::vision::CFeatureList::begin(), mrpt::vision::CFeatureList::end(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::system::os::fclose(), mrpt::vision::featSIFT, mrpt::system::os::fopen(), mrpt::system::os::fprintf(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getWidth(), mrpt::system::launchProcess(), MIN, MRPT_END, MRPT_START, mrpt::utils::CImage::saveToFile(), SIFT_DESCR_HIST_BINS, SIFT_DESCR_WIDTH, SIFT_IMG_DBL, SIFT_INTVLS, SIFT_SIGMA, mrpt::vision::CFeatureList::size(), mrpt::system::os::strcat(), mrpt::system::os::strcpy(), and THROW_EXCEPTION.

void CFeatureExtraction::internal_computeSpinImageDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute the intensity-domain spin images descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.
Note
Additional parameters from CFeatureExtraction::TOptions::SpinImagesOptions are used in this method.

Definition at line 25 of file CFeatureExtraction_spinImg.cpp.

References ASSERT_, mrpt::vision::CFeatureList::begin(), mrpt::utils::CImage::drawCircle(), mrpt::vision::CFeatureList::end(), mrpt::format(), mrpt::utils::CImage::get_unsafe(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getWidth(), mrpt::utils::CImage::isColor(), min, MRPT_END, MRPT_START, R, mrpt::utils::round(), mrpt::utils::CImage::saveToFile(), and mrpt::math::square().

void CFeatureExtraction::internal_computeSurfDescriptors ( const mrpt::utils::CImage in_img,
CFeatureList in_features 
) const
private

Compute the SURF descriptor of the provided features into the input image.

Parameters
in_img(input) The image from where to compute the descriptors.
in_features(input/output) The list of features whose descriptors are going to be computed.

Definition at line 155 of file CFeatureExtraction_SURF.cpp.

References mrpt::vision::CFeatureList::begin(), mrpt::vision::CFeatureList::empty(), mrpt::vision::CFeatureList::end(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::utils::CImage::getAs(), mrpt::vision::CFeatureList::size(), and THROW_EXCEPTION.

void CFeatureExtraction::my_adjust_for_img_dbl ( void features) const
private

Adjust scale if the image was initially doubled.

Parameters
featuresThe sequence of features.

Definition at line 745 of file CFeatureExtraction_SIFT.cpp.

References feature::scl, and THROW_EXCEPTION.

void * CFeatureExtraction::my_scale_space_extrema ( CFeatureList featList,
void dog_pyr,
int  octvs,
int  intvls,
double  contr_thr,
int  curv_thr,
void storage 
) const
private

Computes extrema in the scale space.

Parameters
dog_pyrPyramid of images.
octvsNumber of considered octaves.
intvlsNumber of intervales in octaves.

Definition at line 766 of file CFeatureExtraction_SIFT.cpp.

References mrpt::vision::CFeatureList::begin(), detection_data::c, mrpt::vision::CFeatureList::end(), feat_detection_data, feature::img_pt, int(), detection_data::intvl, MRPT_UNUSED_PARAM, detection_data::octv, detection_data::r, SIFT_SIGMA, detection_data::subintvl, THROW_EXCEPTION, feature::x, and feature::y.

Member Data Documentation

TOptions mrpt::vision::CFeatureExtraction::options

Set all the parameters of the desired method here before calling "detectFeatures".

Definition at line 198 of file CFeatureExtraction.h.

Referenced by mrpt::maps::CLandmarksMap::loadSiftFeaturesFromImageObservation(), and mrpt::slam::COccupancyGridMapFeatureExtractor::uncached_extractFeatures().




Page generated by Doxygen 1.8.11 for MRPT 1.5.7 Git: cdb1297 Tue Jun 12 13:44:11 2018 +0200 at mar jun 12 15:30:13 CEST 2018