ViSP
2.9.0
|
#include <vpKeyPointSurf.h>
Public Types | |
enum | vpDescriptorType { basicDescriptor, extendedDescriptor } |
Public Member Functions | |
vpKeyPointSurf () | |
virtual | ~vpKeyPointSurf () |
unsigned int | buildReference (const vpImage< unsigned char > &I) |
unsigned int | buildReference (const vpImage< unsigned char > &I, const vpImagePoint &iP, const unsigned int height, const unsigned int width) |
unsigned int | buildReference (const vpImage< unsigned char > &I, const vpRect &rectangle) |
unsigned int | matchPoint (const vpImage< unsigned char > &I) |
unsigned int | matchPoint (const vpImage< unsigned char > &I, const vpImagePoint &iP, const unsigned int height, const unsigned int width) |
unsigned int | matchPoint (const vpImage< unsigned char > &I, const vpRect &rectangle) |
void | display (const vpImage< unsigned char > &Iref, const vpImage< unsigned char > &Icurrent, unsigned int size=3) |
void | display (const vpImage< unsigned char > &Icurrent, unsigned int size=3, const vpColor &color=vpColor::green) |
std::list< int * > * | matchPoint (std::list< float * > descriptorList, std::list< int > laplacianList) |
float * | getDescriptorReferencePoint (const int index) |
int | getLaplacianReferencePoint (const int index) |
void | getDescriptorParamReferencePoint (const int index, int &size, float &dir) |
void | setHessianThreshold (double hessian_threshold) |
void | setDescriptorType (vpDescriptorType descriptor_type) |
double | getHessianThreshold () |
vpDescriptorType | getDescriptorType () |
bool | referenceBuilt () const |
const vpImagePoint * | getAllPointsInReferenceImage () |
void | getReferencePoint (const unsigned int index, vpImagePoint &referencePoint) |
void | getMatchedPoints (const unsigned int index, vpImagePoint &referencePoint, vpImagePoint ¤tPoint) |
unsigned int | getIndexInAllReferencePointList (const unsigned int indexInMatchedPointList) |
unsigned int | getReferencePointNumber () const |
unsigned int | getMatchedPointNumber () const |
const std::vector< vpImagePoint > & | getReferenceImagePointsList () const |
const std::vector< vpImagePoint > & | getCurrentImagePointsList () const |
const std::vector< unsigned int > & | getMatchedReferencePoints () const |
Protected Attributes | |
std::vector< vpImagePoint > | referenceImagePointsList |
std::vector< vpImagePoint > | currentImagePointsList |
std::vector< unsigned int > | matchedReferencePoints |
bool | _reference_computed |
Deprecated functions | |
vp_deprecated vpList< int * > * | matchPoint (vpList< float * > descriptorList, vpList< int > laplacianList) |
Class that implements the SURF key points and technics thanks to the OpenCV library.
The goal of this class is to provide a tool to match points from a model and points belonging to an image in which the model appears. The coordinates of the different reference points and matched points are given in pixel thanks to the class vpImagePoint. In this documentation we do not explain the SURF technics. So if you want to learn more about it you can refer to the following article : Herbert Bay, Tinne Tuytelaars and Luc Van Gool "SURF: Speeded Up Robust Features", Proceedings of the 9th European Conference on Computer Vision, Springer LNCS volume 3951, part 1, pp 404–417, 2006.
If you use this class the first things you have to do is to create the reference thanks to a reference image which contains the interesting object to detect. Then you have to grab other images containing the object. After calling the specific method to match points you can access to the lists of matched points thanks to the methods getMatchedPointsInReferenceImage() and getMatchedPointsInCurrentImage(). These two methods return a list of matched points. The nth element of the first list is matched with the nth element of the second list. The following small example show how to use the class.
It is also possible to create the reference thanks to only a part of the reference image (not the whole image) and find points to match in only a part of the current image. The small following example shows how to this
This class is also described in Tutorial: Keypoint matching.
Definition at line 195 of file vpKeyPointSurf.h.
This enumerate enables to set the detail level of the descriptors.
Enumerator | |
---|---|
basicDescriptor | |
extendedDescriptor |
Definition at line 202 of file vpKeyPointSurf.h.
vpKeyPointSurf::vpKeyPointSurf | ( | ) |
Basic constructor. It sets by default the hessian threshold to 500 (a good default value is between 300 and 500) and the descriptor type to extended.
Definition at line 202 of file vpKeyPointSurf.cpp.
|
virtual |
Basic Destructor
Definition at line 227 of file vpKeyPointSurf.cpp.
|
virtual |
Build the list of reference points. The computation of the points is made all over the image I.
I | : The gray scaled image where the reference points are computed. |
Implements vpBasicKeyPoint.
Definition at line 244 of file vpKeyPointSurf.cpp.
References vpBasicKeyPoint::_reference_computed, vpImage< Type >::bitmap, vpImageConvert::convert(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpBasicKeyPoint::referenceImagePointsList.
Referenced by buildReference().
|
virtual |
Build the list of reference points. The computation of the points is made only on a part of the image. This part is a rectangle defined by its top left corner, its height and its width. The parameters of this rectangle must be given in pixel.
I | : The gray scaled image where the reference points are computed. |
iP | : The top left corner of the rectangle. |
height | : height of the rectangle (in pixel). |
width | : width of the rectangle (in pixel). |
Implements vpBasicKeyPoint.
Definition at line 301 of file vpKeyPointSurf.cpp.
References buildReference(), vpImageTools::createSubImage(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpImageException::notInTheImage, vpBasicKeyPoint::referenceImagePointsList, and vpTRACE.
|
virtual |
Build the list of reference points. The computation of the points is made only on a part of the image. This part is a rectangle. The parameters of this rectangle must be given in pixel.
I | : The gray scaled image where the reference points are computed. |
rectangle | : The rectangle which defines the interesting part of the image. |
Implements vpBasicKeyPoint.
Definition at line 346 of file vpKeyPointSurf.cpp.
References buildReference(), vpRect::getHeight(), vpRect::getLeft(), vpRect::getTop(), vpRect::getWidth(), vpImagePoint::set_i(), and vpImagePoint::set_j().
|
virtual |
This function displays the matched reference points and the matched points computed in the current image. The reference points are displayed in the image Ireference and the matched points coming from the current image are displayed in the image Icurrent. It is possible to set Ireference and Icurrent with the same image when calling the method.
Ireference | : The image where the matched reference points are displayed. |
Icurrent | : The image where the matched points computed in the current image are displayed. |
size | : Size in pixels of the cross that is used to display matched points. |
Implements vpBasicKeyPoint.
Definition at line 555 of file vpKeyPointSurf.cpp.
References vpBasicKeyPoint::currentImagePointsList, vpDisplay::displayCross(), vpColor::green, vpBasicKeyPoint::matchedReferencePoints, vpColor::red, and vpBasicKeyPoint::referenceImagePointsList.
|
virtual |
This function displays only the matched points computed in the current image. They are displayed in the image Icurrent.
Icurrent | : The image where the matched points computed in the current image are displayed. |
size | : Size in pixels of the cross that is used to display matched points. |
color | : Color used to display the matched points. |
Implements vpBasicKeyPoint.
Definition at line 590 of file vpKeyPointSurf.cpp.
References vpBasicKeyPoint::currentImagePointsList, vpDisplay::displayCross(), and vpBasicKeyPoint::matchedReferencePoints.
|
inlineinherited |
Get the pointer to the complete list of reference points. The pointer is const. Thus the points can not be modified
Definition at line 115 of file vpBasicKeyPoint.h.
|
inlineinherited |
Return the vector of current image point.
Definition at line 212 of file vpBasicKeyPoint.h.
void vpKeyPointSurf::getDescriptorParamReferencePoint | ( | const int | index, |
int & | size, | ||
float & | dir | ||
) |
Get the parameters of the descriptor of the nth reference point.
index | : The index of the desired reference point. The index must be between 0 and the number of reference points - 1. |
size | : The size of the point used to compute the descriptor. |
dir | : The orientation of the descriptor (in degree). |
Definition at line 759 of file vpKeyPointSurf.cpp.
References vpException::fatalError, vpBasicKeyPoint::referenceImagePointsList, and vpTRACE.
float * vpKeyPointSurf::getDescriptorReferencePoint | ( | const int | index | ) |
Get the descriptor of the nth reference point.
index | : The index of the desired reference point. The index must be between 0 and the number of reference points - 1. |
Definition at line 700 of file vpKeyPointSurf.cpp.
References vpException::fatalError, vpBasicKeyPoint::referenceImagePointsList, and vpTRACE.
|
inline |
Gets the type of descriptor used.
Definition at line 274 of file vpKeyPointSurf.h.
|
inline |
Gets the value of the hessian threhold.
Definition at line 267 of file vpKeyPointSurf.h.
|
inlineinherited |
Get the nth matched reference point index in the complete list of reference point.
In the code below referencePoint1 and referencePoint2 correspond to the same matched reference point.
Definition at line 173 of file vpBasicKeyPoint.h.
References vpException::fatalError, and vpTRACE.
int vpKeyPointSurf::getLaplacianReferencePoint | ( | const int | index | ) |
Get the laplacian of the nth reference point.
index | : The index of the desired reference point. The index must be between 0 and the number of reference points - 1. |
Definition at line 728 of file vpKeyPointSurf.cpp.
References vpException::fatalError, vpBasicKeyPoint::referenceImagePointsList, and vpTRACE.
|
inlineinherited |
Get the number of matched points.
Definition at line 194 of file vpBasicKeyPoint.h.
|
inlineinherited |
Get the nth couple of reference point and current point which have been matched. These points are copied in the vpImagePoint instances given in argument.
index | : The index of the desired couple of reference point and current point . The index must be between 0 and the number of matched points - 1. |
referencePoint | : The coordinates of the desired reference point are copied here. |
currentPoint | : The coordinates of the desired current point are copied here. |
Definition at line 143 of file vpBasicKeyPoint.h.
References vpException::fatalError, vpImagePoint::set_ij(), and vpTRACE.
|
inlineinherited |
Return the index of the matched associated to the current image point i. The ith element of the vector is the index of the reference image point matching with the current image point.
Definition at line 223 of file vpBasicKeyPoint.h.
|
inlineinherited |
Return the vector of reference image point.
Definition at line 203 of file vpBasicKeyPoint.h.
|
inlineinherited |
Get the nth reference point. This point is copied in the vpImagePoint instance given in argument.
index | : The index of the desired reference point. The index must be between 0 and the number of reference points - 1. |
referencePoint | : The coordinates of the desired reference point are copied there. |
Definition at line 125 of file vpBasicKeyPoint.h.
References vpException::fatalError, vpImagePoint::set_ij(), and vpTRACE.
|
inlineinherited |
Get the number of reference points.
Definition at line 187 of file vpBasicKeyPoint.h.
|
virtual |
Computes the SURF points in the current image I and try to matched them with the points in the reference list. Only the matched points are stored.
I | : The gray scaled image where the points are computed. |
Implements vpBasicKeyPoint.
Definition at line 368 of file vpKeyPointSurf.cpp.
References vpImage< Type >::bitmap, vpImageConvert::convert(), vpBasicKeyPoint::currentImagePointsList, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpBasicKeyPoint::matchedReferencePoints.
Referenced by matchPoint().
|
virtual |
Computes the SURF points in only a part of the current image I and try to matched them with the points in the reference list. The part of the image is a rectangle defined by its top left corner, its height and its width. The parameters of this rectangle must be given in pixel. Only the matched points are stored.
I | : The gray scaled image where the points are computed. |
iP | : The top left corner of the rectangle. |
height | : height of the rectangle (in pixel). |
width | : width of the rectangle (in pixel). |
Implements vpBasicKeyPoint.
Definition at line 478 of file vpKeyPointSurf.cpp.
References vpImageTools::createSubImage(), vpBasicKeyPoint::currentImagePointsList, vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), matchPoint(), vpImageException::notInTheImage, and vpTRACE.
|
virtual |
Computes the SURF points in only a part of the current image I and try to matched them with the points in the reference list. The part of the image is a rectangle. The parameters of this rectangle must be given in pixel. Only the matched points are stored.
I | : The gray scaled image where the points are computed. |
rectangle | : The rectangle which defines the interesting part of the image. |
Implements vpBasicKeyPoint.
Definition at line 525 of file vpKeyPointSurf.cpp.
References vpRect::getHeight(), vpRect::getLeft(), vpRect::getTop(), vpRect::getWidth(), matchPoint(), vpImagePoint::set_i(), and vpImagePoint::set_j().
std::list< int * > * vpKeyPointSurf::matchPoint | ( | std::list< float * > | descriptorList, |
std::list< int > | laplacianList | ||
) |
Definition at line 659 of file vpKeyPointSurf.cpp.
References vpTRACE.
vp_deprecated vpList< int * > * vpKeyPointSurf::matchPoint | ( | vpList< float * > | descriptorList, |
vpList< int > | laplacianList | ||
) |
Computes the SURF points given by their descriptor and laplacian and try to match them with the points in the reference list. Only the matched points are stored. The two lists must have the same number of element while they correspond the same unique list of point.
descriptorList | : The list of the descriptor |
laplacianList | : The list of laplacian |
Definition at line 622 of file vpKeyPointSurf.cpp.
References vpList< type >::addRight(), vpList< type >::front(), vpList< type >::nb, vpList< type >::next(), vpList< type >::outside(), vpList< type >::value(), and vpTRACE.
|
inlineinherited |
Indicate wether the reference has been built or not.
Definition at line 108 of file vpBasicKeyPoint.h.
|
inline |
Sets the type of descriptors to use.
descriptor_type | : Type of descriptor to use. |
Definition at line 257 of file vpKeyPointSurf.h.
|
inline |
Sets the value of the hessian threhold. Note that during the computation of the hessian for each potential points, only the points which have a hessian value higher than the threshold are keeped. Fore more details about the threshold see the article Herbert Bay, Tinne Tuytelaars and Luc Van Gool "SURF: Speeded Up Robust Features", Proceedings of the 9th European Conference on Computer Vision, Springer LNCS volume 3951, part 1, pp 404–417, 2006.
hessian_threshold | : Desired hessian threshold value. |
Definition at line 246 of file vpKeyPointSurf.h.
|
protectedinherited |
flag to indicate if the reference has been built.
Definition at line 249 of file vpBasicKeyPoint.h.
Referenced by buildReference(), and vpFernClassifier::buildReference().
|
protectedinherited |
List of the points which belong to the current image and have been matched with points belonging to the reference.
Definition at line 238 of file vpBasicKeyPoint.h.
Referenced by display(), vpFernClassifier::display(), matchPoint(), and vpFernClassifier::matchPoint().
|
protectedinherited |
Array containing the index in the array "referenceImagePointsList" of the reference points which have been matched.
The first element of the "currentImagePointsList" array is matched with the nth element of the "referenceImagePointsList" array. The value of n is stored in the first element of the "matchedReferencePoints" array.
Definition at line 246 of file vpBasicKeyPoint.h.
Referenced by display(), vpFernClassifier::display(), matchPoint(), and vpFernClassifier::matchPoint().
|
protectedinherited |
List of the points which define the reference.
Definition at line 232 of file vpBasicKeyPoint.h.
Referenced by buildReference(), display(), vpFernClassifier::display(), getDescriptorParamReferencePoint(), getDescriptorReferencePoint(), getLaplacianReferencePoint(), and vpFernClassifier::train().