Main MRPT website > C++ reference
MRPT logo
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Friends
mrpt::vision::CFeature Class Reference

Detailed Description

A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or more descriptors (see descriptors), in addition to an image patch.

The (Euclidean) distance between descriptors in a pair of features can be computed with descriptorDistanceTo, while the similarity of the patches is given by patchCorrelationTo.

See also:
CFeatureList, TSimpleFeature, TSimpleFeatureList

#include <mrpt/vision/CFeature.h>

Inheritance diagram for mrpt::vision::CFeature:
Inheritance graph
[legend]

List of all members.

Classes

struct  TDescriptors
 All the possible descriptors this feature may have. More...

Public Member Functions

bool isPointFeature () const
 Return false only for Blob detectors (SIFT, SURF)
bool getFirstDescriptorAsMatrix (mrpt::math::CMatrixFloat &desc) const
 Return the first found descriptor, as a matrix.
float patchCorrelationTo (const CFeature &oFeature) const
 Computes the normalized cross-correlation between the patches of this and another feature (normalized in the range [0,1], such as 0=best, 1=worst).
float descriptorDistanceTo (const CFeature &oFeature, TDescriptorType descriptorToUse=descAny, bool normalize_distances=true) const
 Computes the Euclidean Distance between this feature's and other feature's descriptors, using the given descriptor or the first present one.
float descriptorSIFTDistanceTo (const CFeature &oFeature, bool normalize_distances=true) const
 Computes the Euclidean Distance between "this" and the "other" descriptors.
float descriptorSURFDistanceTo (const CFeature &oFeature, bool normalize_distances=true) const
 Computes the Euclidean Distance between "this" and the "other" descriptors.
float descriptorSpinImgDistanceTo (const CFeature &oFeature, bool normalize_distances=true) const
 Computes the Euclidean Distance between "this" and the "other" descriptors.
float descriptorPolarImgDistanceTo (const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
 Returns the minimum Euclidean Distance between "this" and the "other" polar image descriptor, for the best shift in orientation.
float descriptorLogPolarImgDistanceTo (const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
 Returns the minimum Euclidean Distance between "this" and the "other" log-polar image descriptor, for the best shift in orientation.
void saveToTextFile (const std::string &filename, bool APPEND=false)
 Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI]_i" "%% |---------------------- feature ------------------| |---------------------- descriptors ------------------------|" "%% with:\n" "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST\n" "%% HAS_* : 1 if a descriptor of that type is associated to the feature." "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1" "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1" "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1" "%%-------------------------------------------------------------------------------------------\n");.
TFeatureType get_type () const
 Get the type of the feature.
void dumpToTextStream (mrpt::utils::CStream &out) const
 Dump feature information into a text stream.
void dumpToConsole () const
 CFeature ()
 Constructor.
virtual ~CFeature ()
 Virtual destructor.
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).
CObjectclone () const
 Cloning interface for smart pointers.

Public Attributes

float x
float y
 Coordinates in the image.
TFeatureID ID
 ID of the feature.
CImage patch
 A patch of the image surrounding the feature.
uint16_t patchSize
 Size of the patch (patchSize x patchSize) (it must be an odd number)
TFeatureType type
 Type of the feature: featNotDefined, featSIFT, featKLT, featHarris, featSURF, featBeacon.
TFeatureTrackStatus track_status
 Status of the feature tracking process (old name: KLT_status)
float response
 A measure of the "goodness" of the feature (old name: KLT_val)
float orientation
 Main orientation of the feature.
float scale
 Feature scale into the scale space.
uint8_t user_flags
 A field for any other flags needed by the user (this has not a predefined meaning)
uint16_t nTimesSeen
 Number of frames it has been seen in a sequence of images.
uint16_t nTimesNotSeen
 Number of frames it has not been seen in a sequence of images.
uint16_t nTimesLastSeen
 Number of frames since it was seen for the last time.
double depth
 The estimated depth in 3D of this feature wrt the camera in the current frame.
double initialDepth
 The estimated depth in 3D of this feature wrt the camera that took its image.
TPoint3D p3D
 The estimated 3D point of this feature wrt its camera.
deque< double > multiScales
 A set of scales where the multi-resolution descriptor has been computed.
deque< vector< double > > multiOrientations
 A vector of main orientations (there is a vector of orientations for each scale)
deque< vector< vector< int32_t > > > multiHashCoeffs
 A set of vectors containing the coefficients for a HASH table of descriptors.
struct VISION_IMPEXP
mrpt::vision::CFeature::TDescriptors 
descriptors

Static Public Attributes

static const
mrpt::utils::TRuntimeClassId 
classCObject

Protected Member Functions

virtual void writeToStream (mrpt::utils::CStream &out, int *getVersion) const =0
 Introduces a pure virtual method responsible for writing to a CStream.
virtual void readFromStream (mrpt::utils::CStream &in, int version)=0
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Static Protected Member Functions

static float internal_distanceBetweenPolarImages (const mrpt::math::CMatrix &desc1, const mrpt::math::CMatrix &desc2, float &minDistAngle, bool normalize_distances, bool dont_shift_angle)
 Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo".

Friends

class CFeatureList
class CMatchedFeatureList

RTTI stuff

class mrpt::utils::CStream
static const
mrpt::utils::TRuntimeClassId 
classCSerializable

RTTI stuff

typedef CFeaturePtr SmartPtr
static mrpt::utils::CLASSINIT _init_CFeature
static mrpt::utils::TRuntimeClassId classCFeature
static const
mrpt::utils::TRuntimeClassId
classinfo
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CFeaturePtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 83 of file CFeature.h.


Constructor & Destructor Documentation

mrpt::vision::CFeature::CFeature ( )

Constructor.

virtual mrpt::vision::CFeature::~CFeature ( ) [inline, virtual]

Virtual destructor.

Definition at line 207 of file CFeature.h.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::vision::CFeature::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::utils::CSerializable.

CObject* mrpt::utils::CObject::clone ( ) const [inline, inherited]

Cloning interface for smart pointers.

Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.

Definition at line 154 of file CObject.h.

static CFeaturePtr mrpt::vision::CFeature::Create ( ) [static]
static mrpt::utils::CObject* mrpt::vision::CFeature::CreateObject ( ) [static]
float mrpt::vision::CFeature::descriptorDistanceTo ( const CFeature oFeature,
TDescriptorType  descriptorToUse = descAny,
bool  normalize_distances = true 
) const

Computes the Euclidean Distance between this feature's and other feature's descriptors, using the given descriptor or the first present one.

Note:
If descriptorToUse is not descAny and that descriptor is not present in one of the features, an exception will be raised.
See also:
patchCorrelationTo
float mrpt::vision::CFeature::descriptorLogPolarImgDistanceTo ( const CFeature oFeature,
float &  minDistAngle,
bool  normalize_distances = true 
) const

Returns the minimum Euclidean Distance between "this" and the "other" log-polar image descriptor, for the best shift in orientation.

Parameters:
oFeatureThe other feature to compare with.
minDistAngleThe placeholder for the angle at which the smallest distance is found.
Returns:
The distance for the best orientation (minimum distance).
float mrpt::vision::CFeature::descriptorPolarImgDistanceTo ( const CFeature oFeature,
float &  minDistAngle,
bool  normalize_distances = true 
) const

Returns the minimum Euclidean Distance between "this" and the "other" polar image descriptor, for the best shift in orientation.

Parameters:
oFeatureThe other feature to compare with.
minDistAngleThe placeholder for the angle at which the smallest distance is found.
Returns:
The distance for the best orientation (minimum distance).
float mrpt::vision::CFeature::descriptorSIFTDistanceTo ( const CFeature oFeature,
bool  normalize_distances = true 
) const

Computes the Euclidean Distance between "this" and the "other" descriptors.

float mrpt::vision::CFeature::descriptorSpinImgDistanceTo ( const CFeature oFeature,
bool  normalize_distances = true 
) const

Computes the Euclidean Distance between "this" and the "other" descriptors.

float mrpt::vision::CFeature::descriptorSURFDistanceTo ( const CFeature oFeature,
bool  normalize_distances = true 
) const

Computes the Euclidean Distance between "this" and the "other" descriptors.

void mrpt::vision::CFeature::dumpToConsole ( ) const
void mrpt::vision::CFeature::dumpToTextStream ( mrpt::utils::CStream out) const

Dump feature information into a text stream.

virtual mrpt::utils::CObject* mrpt::vision::CFeature::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const [inline, inherited]

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 151 of file CObject.h.

TFeatureType mrpt::vision::CFeature::get_type ( ) const [inline]

Get the type of the feature.

Definition at line 195 of file CFeature.h.

bool mrpt::vision::CFeature::getFirstDescriptorAsMatrix ( mrpt::math::CMatrixFloat desc) const

Return the first found descriptor, as a matrix.

Returns:
false on error, i.e. there is no valid descriptor.
virtual const mrpt::utils::TRuntimeClassId* mrpt::vision::CFeature::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

static float mrpt::vision::CFeature::internal_distanceBetweenPolarImages ( const mrpt::math::CMatrix desc1,
const mrpt::math::CMatrix desc2,
float &  minDistAngle,
bool  normalize_distances,
bool  dont_shift_angle 
) [static, protected]

Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo".

bool mrpt::vision::CFeature::isPointFeature ( ) const

Return false only for Blob detectors (SIFT, SURF)

float mrpt::vision::CFeature::patchCorrelationTo ( const CFeature oFeature) const

Computes the normalized cross-correlation between the patches of this and another feature (normalized in the range [0,1], such as 0=best, 1=worst).

Note:
If this or the other features does not have patches or they are of different sizes, an exception will be raised.
See also:
descriptorDistanceTo
virtual void mrpt::utils::CSerializable::readFromStream ( mrpt::utils::CStream in,
int  version 
) [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters:
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions:
std::exceptionOn any error, see CStream::ReadBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.

void mrpt::vision::CFeature::saveToTextFile ( const std::string filename,
bool  APPEND = false 
)

Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI]_i" "%% |---------------------- feature ------------------| |---------------------- descriptors ------------------------|" "%% with:\n" "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST\n" "%% HAS_* : 1 if a descriptor of that type is associated to the feature." "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1" "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1" "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1" "%%-------------------------------------------------------------------------------------------\n");.

virtual void mrpt::utils::CSerializable::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters:
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions:
std::exceptionOn any error, see CStream::WriteBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.


Friends And Related Function Documentation

friend class CFeatureList [friend]

Definition at line 80 of file CFeature.h.

friend class CMatchedFeatureList [friend]

Definition at line 81 of file CFeature.h.

friend class mrpt::utils::CStream [friend, inherited]

Member Data Documentation

Definition at line 83 of file CFeature.h.

Definition at line 83 of file CFeature.h.

Definition at line 139 of file CObject.h.

Definition at line 56 of file CSerializable.h.

Definition at line 83 of file CFeature.h.

The estimated depth in 3D of this feature wrt the camera in the current frame.

Definition at line 100 of file CFeature.h.

ID of the feature.

Definition at line 87 of file CFeature.h.

The estimated depth in 3D of this feature wrt the camera that took its image.

Definition at line 101 of file CFeature.h.

A set of vectors containing the coefficients for a HASH table of descriptors.

Definition at line 105 of file CFeature.h.

A vector of main orientations (there is a vector of orientations for each scale)

Definition at line 104 of file CFeature.h.

A set of scales where the multi-resolution descriptor has been computed.

Definition at line 103 of file CFeature.h.

Number of frames since it was seen for the last time.

Definition at line 98 of file CFeature.h.

Number of frames it has not been seen in a sequence of images.

Definition at line 97 of file CFeature.h.

Number of frames it has been seen in a sequence of images.

Definition at line 96 of file CFeature.h.

Main orientation of the feature.

Definition at line 93 of file CFeature.h.

The estimated 3D point of this feature wrt its camera.

Definition at line 102 of file CFeature.h.

A patch of the image surrounding the feature.

Definition at line 88 of file CFeature.h.

Size of the patch (patchSize x patchSize) (it must be an odd number)

Definition at line 89 of file CFeature.h.

A measure of the "goodness" of the feature (old name: KLT_val)

Definition at line 92 of file CFeature.h.

Feature scale into the scale space.

Definition at line 94 of file CFeature.h.

Status of the feature tracking process (old name: KLT_status)

Definition at line 91 of file CFeature.h.

Type of the feature: featNotDefined, featSIFT, featKLT, featHarris, featSURF, featBeacon.

Definition at line 90 of file CFeature.h.

A field for any other flags needed by the user (this has not a predefined meaning)

Definition at line 95 of file CFeature.h.

Definition at line 86 of file CFeature.h.

Coordinates in the image.

Definition at line 86 of file CFeature.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011