Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpKeyPointSurf.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Key point Surf.
33  *
34  * Authors:
35  * Nicolas Melchior
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 <cv.h>
65 #include <cxcore.h>
66 #endif
67 
183 class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
184 {
185 public:
190  typedef enum {
191  basicDescriptor, /*<! basicDescriptor means that the descriptors are
192  composed by 64 elements floating-point vector. */
193  extendedDescriptor /*<! Means that the descriptors are composed by
194  128 elements floating-point vector. */
195  } vpDescriptorType;
196 
197 public:
198  vpKeyPointSurf();
199 
200  virtual ~vpKeyPointSurf();
201 
202  unsigned int buildReference(const vpImage<unsigned char> &I);
203  unsigned int buildReference(const vpImage<unsigned char> &I, const vpImagePoint &iP, const unsigned int height,
204  const unsigned int width);
205  unsigned int buildReference(const vpImage<unsigned char> &I, const vpRect &rectangle);
206  unsigned int matchPoint(const vpImage<unsigned char> &I);
207  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpImagePoint &iP, const unsigned int height,
208  const unsigned int width);
209  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect &rectangle);
210  void display(const vpImage<unsigned char> &Iref, const vpImage<unsigned char> &Icurrent, unsigned int size = 3);
211  void display(const vpImage<unsigned char> &Icurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
212  std::list<int *> *matchPoint(std::list<float *> descriptorList, std::list<int> laplacianList);
213  float *getDescriptorReferencePoint(const int index);
214  int getLaplacianReferencePoint(const int index);
215  void getDescriptorParamReferencePoint(const int index, int &size, float &dir);
229  void setHessianThreshold(double hessian_threshold)
230  {
231  this->hessianThreshold = hessian_threshold;
232  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
233  };
234 
241  void setDescriptorType(vpDescriptorType descriptor_type)
242  {
243  this->descriptorType = descriptor_type;
244  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
245  };
246 
252  double getHessianThreshold() { return hessianThreshold; }
253 
259  vpDescriptorType getDescriptorType() { return descriptorType; }
260 
261 private:
262  void init();
263 
264 private:
265  // OpenCV Parameters
266  CvMemStorage *storage;
267  CvSURFParams params;
268  CvMemStorage *storage_cur;
269 
270  CvSeq *image_keypoints;
271  CvSeq *image_descriptors;
272 
273  CvSeq *ref_keypoints;
274  CvSeq *ref_descriptors;
275 
283  double hessianThreshold;
284  vpDescriptorType descriptorType;
285 };
286 
287 #endif
288 
289 #endif
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:120
static const vpColor green
Definition: vpColor.h:183
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
Defines a rectangle in the plane.
Definition: vpRect.h:78
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88