ViSP  2.9.0
vpKeyPointSurf.h
1 /****************************************************************************
2  *
3  * $Id: vpKeyPointSurf.h 4649 2014-02-07 14:57:11Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 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 
195 class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
196 {
197  public:
202  typedef enum
203  {
204  basicDescriptor, /*<! basicDescriptor means that the descriptors are
205  composed by 64 elements floating-point vector. */
206  extendedDescriptor /*<! Means that the descriptors are composed by
207  128 elements floating-point vector. */
208  } vpDescriptorType;
209 
210  public:
211  vpKeyPointSurf();
212 
213  virtual ~vpKeyPointSurf();
214 
215  unsigned int buildReference(const vpImage<unsigned char> &I);
216  unsigned int buildReference(const vpImage<unsigned char> &I,
217  const vpImagePoint &iP,
218  const unsigned int height, const unsigned int width);
219  unsigned int buildReference(const vpImage<unsigned char> &I,
220  const vpRect& rectangle);
221  unsigned int matchPoint(const vpImage<unsigned char> &I);
222  unsigned int matchPoint(const vpImage<unsigned char> &I,
223  const vpImagePoint &iP, const unsigned int height, const unsigned int width);
224  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect& rectangle);
225  void display(const vpImage<unsigned char> &Iref,
226  const vpImage<unsigned char> &Icurrent, unsigned int size=3);
227  void display(const vpImage<unsigned char> &Icurrent, unsigned int size=3,
228  const vpColor &color=vpColor::green);
229  std::list<int*>* matchPoint(std::list<float*> descriptorList, std::list<int> laplacianList);
230  float* getDescriptorReferencePoint (const int index);
231  int getLaplacianReferencePoint (const int index);
232  void getDescriptorParamReferencePoint (const int index, int& size, float& dir);
246  void setHessianThreshold (double hessian_threshold) {
247  this->hessianThreshold = hessian_threshold;
248  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
249  } ;
250 
257  void setDescriptorType (vpDescriptorType descriptor_type) {
258  this->descriptorType = descriptor_type;
259  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
260  } ;
261 
267  double getHessianThreshold () {return hessianThreshold;} ;
268 
274  vpDescriptorType getDescriptorType () {return descriptorType;} ;
275 
276 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
277 
280  vp_deprecated vpList<int*>* matchPoint(vpList<float*> descriptorList, vpList<int> laplacianList);
281 #endif
282 
283  private:
284  void init();
285 
286  private:
287  //OpenCV Parameters
288  CvMemStorage* storage;
289  CvSURFParams params;
290  CvMemStorage* storage_cur;
291 
292  CvSeq* image_keypoints;
293  CvSeq* image_descriptors;
294 
295  CvSeq* ref_keypoints;
296  CvSeq* ref_descriptors;
297 
305  double hessianThreshold;
306  vpDescriptorType descriptorType;
307 
308 };
309 
310 
311 #endif
312 
313 #endif
314 
315 
class that defines what is a Keypoint. This class provides all the basic elements to implement classe...
Provide simple list management.
Definition: vpList.h:113
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
void setHessianThreshold(double hessian_threshold)
static const vpColor green
Definition: vpColor.h:170
double getHessianThreshold()
void setDescriptorType(vpDescriptorType descriptor_type)
Class that implements the SURF key points and technics thanks to the OpenCV library.
virtual unsigned int buildReference(const vpImage< unsigned char > &I)=0
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:85
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92