Visual Servoing Platform  version 3.3.0 under development (2020-02-17)
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 
182 class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
183 {
184 public:
189  typedef enum {
190  basicDescriptor, /*<! basicDescriptor means that the descriptors are
191  composed by 64 elements floating-point vector. */
192  extendedDescriptor /*<! Means that the descriptors are composed by
193  128 elements floating-point vector. */
194  } vpDescriptorType;
195 
196 public:
197  vpKeyPointSurf();
198 
199  virtual ~vpKeyPointSurf();
200 
201  unsigned int buildReference(const vpImage<unsigned char> &I);
202  unsigned int buildReference(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
203  unsigned int width);
204  unsigned int buildReference(const vpImage<unsigned char> &I, const vpRect &rectangle);
205  unsigned int matchPoint(const vpImage<unsigned char> &I);
206  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
207  unsigned int width);
208  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect &rectangle);
209  void display(const vpImage<unsigned char> &Iref, const vpImage<unsigned char> &Icurrent, unsigned int size = 3);
210  void display(const vpImage<unsigned char> &Icurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
211  std::list<int *> *matchPoint(std::list<float *> descriptorList, std::list<int> laplacianList);
212  float *getDescriptorReferencePoint(int index);
213  int getLaplacianReferencePoint(int index);
214  void getDescriptorParamReferencePoint(int index, int &size, float &dir);
228  void setHessianThreshold(double hessian_threshold)
229  {
230  this->hessianThreshold = hessian_threshold;
231  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
232  };
233 
240  void setDescriptorType(vpDescriptorType descriptor_type)
241  {
242  this->descriptorType = descriptor_type;
243  params = cvSURFParams(this->hessianThreshold, this->descriptorType);
244  };
245 
251  double getHessianThreshold() { return hessianThreshold; }
252 
258  vpDescriptorType getDescriptorType() { return descriptorType; }
259 
260 private:
261  void init();
262 
263 private:
264  // OpenCV Parameters
265  CvMemStorage *storage;
266  CvSURFParams params;
267  CvMemStorage *storage_cur;
268 
269  CvSeq *image_keypoints;
270  CvSeq *image_descriptors;
271 
272  CvSeq *ref_keypoints;
273  CvSeq *ref_descriptors;
274 
282  double hessianThreshold;
283  vpDescriptorType descriptorType;
284 };
285 
286 #endif
287 
288 #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:119
static const vpColor green
Definition: vpColor.h:182
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