ViSP  2.8.0
vpKeyPointSurf.h
1 /****************************************************************************
2  *
3  * $Id: vpKeyPointSurf.h 4201 2013-04-08 08:20:47Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Key point Surf.
36  *
37  * Authors:
38  * Nicolas Melchior
39  *
40  *****************************************************************************/
41 
42 
43 #ifndef vpKeyPointSurf_H
44 #define vpKeyPointSurf_H
45 
53 #include <visp/vpBasicKeyPoint.h>
54 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
55 # include <visp/vpList.h>
56 #endif
57 
58 #include <list>
59 #include <vector>
60 
61 #if defined (VISP_HAVE_OPENCV_NONFREE)
62 
63 
64 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400) // Require opencv >= 2.4.0
65 # include <opencv2/features2d/features2d.hpp>
66 # include <opencv2/legacy/compat.hpp>
67 # include <opencv2/nonfree/nonfree.hpp>
68 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
69 # include <opencv2/features2d/features2d.hpp>
70 #elif (VISP_HAVE_OPENCV_VERSION >= 0x010100) // Require opencv >= 1.1.0
71 # include <cxcore.h>
72 # include <cv.h>
73 #endif
74 
193 class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
194 {
195  public:
200  typedef enum
201  {
202  basicDescriptor, /*<! basicDescriptor means that the descriptors are
203  composed by 64 elements floating-point vector. */
204  extendedDescriptor /*<! Means that the descriptors are composed by
205  128 elements floating-point vector. */
206  } vpDescriptorType;
207 
208  public:
209  vpKeyPointSurf();
210 
211  virtual ~vpKeyPointSurf();
212 
213  unsigned int buildReference(const vpImage<unsigned char> &I);
214  unsigned int buildReference(const vpImage<unsigned char> &I,
215  const vpImagePoint &iP,
216  const unsigned int height, const unsigned int width);
217  unsigned int buildReference(const vpImage<unsigned char> &I,
218  const vpRect& rectangle);
219  unsigned int matchPoint(const vpImage<unsigned char> &I);
220  unsigned int matchPoint(const vpImage<unsigned char> &I,
221  const vpImagePoint &iP, const unsigned int height, const unsigned int width);
222  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect& rectangle);
223  void display(const vpImage<unsigned char> &Iref,
224  const vpImage<unsigned char> &Icurrent, unsigned int size=3);
225  void display(const vpImage<unsigned char> &Icurrent, unsigned int size=3,
226  const vpColor &color=vpColor::green);
227  std::list<int*>* matchPoint(std::list<float*> descriptorList, std::list<int> laplacianList);
228  float* getDescriptorReferencePoint (const int index);
229  int getLaplacianReferencePoint (const int index);
230  void getDescriptorParamReferencePoint (const int index, int& size, float& dir);
244  void setHessianThreshold (double hessianThreshold) {
245  this->hessianThreshold = hessianThreshold;
246  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
247  } ;
248 
255  void setDescriptorType (vpDescriptorType descriptorType) {
256  this->descriptorType = descriptorType;
257  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
258  } ;
259 
265  double getHessianThreshold () {return hessianThreshold;} ;
266 
272  vpDescriptorType getDescriptorType () {return descriptorType;} ;
273 
274 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
275 
278  vp_deprecated vpList<int*>* matchPoint(vpList<float*> descriptorList, vpList<int> laplacianList);
279 #endif
280 
281  private:
282  void init();
283 
284  private:
285  //OpenCV Parameters
286  CvMemStorage* storage;
287  CvSURFParams params;
288  CvMemStorage* storage_cur;
289 
290  CvSeq* image_keypoints;
291  CvSeq* image_descriptors;
292 
293  CvSeq* ref_keypoints;
294  CvSeq* ref_descriptors;
295 
303  double hessianThreshold;
304  vpDescriptorType descriptorType;
305 
306 };
307 
308 
309 #endif
310 
311 #endif
312 
313 
class that defines what is a Keypoint. This class provides all the basic elements to implement classe...
Provide simple list management.
Definition: vpList.h:112
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
static const vpColor green
Definition: vpColor.h:170
double getHessianThreshold()
Class that implements the SURF key points and technics thanks to the OpenCV library.
virtual unsigned int buildReference(const vpImage< unsigned char > &I)=0
void setHessianThreshold(double hessianThreshold)
virtual void display(const vpImage< unsigned char > &Iref, const vpImage< unsigned char > &Icurrent, unsigned int size=3)=0
virtual unsigned int matchPoint(const vpImage< unsigned char > &I)=0
vpDescriptorType getDescriptorType()
Defines a rectangle in the plane.
Definition: vpRect.h:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
void setDescriptorType(vpDescriptorType descriptorType)