Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpKeyPointSurf.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Key point Surf.
32  *
33  * Authors:
34  * Nicolas Melchior
35  *
36  *****************************************************************************/
37 
38 
39 #ifndef vpKeyPointSurf_H
40 #define vpKeyPointSurf_H
41 
49 #include <visp3/vision/vpBasicKeyPoint.h>
50 
51 #include <list>
52 #include <vector>
53 
54 #if defined (VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION < 0x030000)
55 
56 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400) // Require opencv >= 1.1.0 < 3.0.0
57 # include <opencv2/core/core.hpp>
58 # include <opencv2/features2d/features2d.hpp>
59 # include <opencv2/legacy/compat.hpp>
60 # include <opencv2/nonfree/nonfree.hpp>
61 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
62 # include <opencv2/features2d/features2d.hpp>
63 #elif (VISP_HAVE_OPENCV_VERSION >= 0x010100) // Require opencv >= 1.1.0
64 # include <cxcore.h>
65 # include <cv.h>
66 #endif
67 
188 class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
189 {
190  public:
195  typedef enum
196  {
197  basicDescriptor, /*<! basicDescriptor means that the descriptors are
198  composed by 64 elements floating-point vector. */
199  extendedDescriptor /*<! Means that the descriptors are composed by
200  128 elements floating-point vector. */
201  } vpDescriptorType;
202 
203  public:
204  vpKeyPointSurf();
205 
206  virtual ~vpKeyPointSurf();
207 
208  unsigned int buildReference(const vpImage<unsigned char> &I);
209  unsigned int buildReference(const vpImage<unsigned char> &I,
210  const vpImagePoint &iP,
211  const unsigned int height, const unsigned int width);
212  unsigned int buildReference(const vpImage<unsigned char> &I,
213  const vpRect& rectangle);
214  unsigned int matchPoint(const vpImage<unsigned char> &I);
215  unsigned int matchPoint(const vpImage<unsigned char> &I,
216  const vpImagePoint &iP, const unsigned int height, const unsigned int width);
217  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect& rectangle);
218  void display(const vpImage<unsigned char> &Iref,
219  const vpImage<unsigned char> &Icurrent, unsigned int size=3);
220  void display(const vpImage<unsigned char> &Icurrent, unsigned int size=3,
221  const vpColor &color=vpColor::green);
222  std::list<int*>* matchPoint(std::list<float*> descriptorList, std::list<int> laplacianList);
223  float* getDescriptorReferencePoint (const int index);
224  int getLaplacianReferencePoint (const int index);
225  void getDescriptorParamReferencePoint (const int index, int& size, float& dir);
239  void setHessianThreshold (double hessian_threshold) {
240  this->hessianThreshold = hessian_threshold;
241  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
242  } ;
243 
250  void setDescriptorType (vpDescriptorType descriptor_type) {
251  this->descriptorType = descriptor_type;
252  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
253  } ;
254 
260  double getHessianThreshold () {return hessianThreshold;}
261 
267  vpDescriptorType getDescriptorType () {return descriptorType;}
268 
269  private:
270  void init();
271 
272  private:
273  //OpenCV Parameters
274  CvMemStorage* storage;
275  CvSURFParams params;
276  CvMemStorage* storage_cur;
277 
278  CvSeq* image_keypoints;
279  CvSeq* image_descriptors;
280 
281  CvSeq* ref_keypoints;
282  CvSeq* ref_descriptors;
283 
291  double hessianThreshold;
292  vpDescriptorType descriptorType;
293 
294 };
295 
296 
297 #endif
298 
299 #endif
300 
301 
class that defines what is a Keypoint. This class provides all the basic elements to implement classe...
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
void setHessianThreshold(double hessian_threshold)
static const vpColor green
Definition: vpColor.h:166
double getHessianThreshold()
void setDescriptorType(vpDescriptorType descriptor_type)
Class that implements the SURF key points and technics thanks to 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:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88