This file is indexed.

/usr/include/visp/vpKeyPointSurf.h is in libvisp-dev 2.8.0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
/****************************************************************************
 *
 * $Id: vpKeyPointSurf.h 4201 2013-04-08 08:20:47Z fspindle $
 *
 * This file is part of the ViSP software.
 * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * ("GPL") version 2 as published by the Free Software Foundation.
 * See the file LICENSE.txt at the root directory of this source
 * distribution for additional information about the GNU GPL.
 *
 * For using ViSP with software that can not be combined with the GNU
 * GPL, please contact INRIA about acquiring a ViSP Professional 
 * Edition License.
 *
 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
 * 
 * This software was developed at:
 * INRIA Rennes - Bretagne Atlantique
 * Campus Universitaire de Beaulieu
 * 35042 Rennes Cedex
 * France
 * http://www.irisa.fr/lagadic
 *
 * If you have questions regarding the use of this file, please contact
 * INRIA at visp@inria.fr
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Description:
 * Key point Surf.
 *
 * Authors:
 * Nicolas Melchior
 *
 *****************************************************************************/


#ifndef vpKeyPointSurf_H
#define vpKeyPointSurf_H

/*!
  \file vpKeyPointSurf.h

  \brief Class that implements the SURF key points and technics thanks
  to the OpenCV library.
*/

#include <visp/vpBasicKeyPoint.h>
#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
#  include <visp/vpList.h>
#endif

#include <list>
#include <vector>

#if defined (VISP_HAVE_OPENCV_NONFREE)


#if (VISP_HAVE_OPENCV_VERSION >= 0x020400) // Require opencv >= 2.4.0
#  include <opencv2/features2d/features2d.hpp>
#  include <opencv2/legacy/compat.hpp>
#  include <opencv2/nonfree/nonfree.hpp>
#elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
#  include <opencv2/features2d/features2d.hpp>
#elif (VISP_HAVE_OPENCV_VERSION >= 0x010100) // Require opencv >= 1.1.0
#  include <cxcore.h>
#  include <cv.h>
#endif

/*!
  \class vpKeyPointSurf

  \brief Class that implements the SURF key points and technics thanks
  to the OpenCV library.

  The goal of this class is to provide a tool to match points from a
  model and points belonging to an image in which the model appears.
  The coordinates of the different reference points and matched points
  are given in pixel thanks to the class vpImagePoint. In this
  documentation we do not explain the SURF technics. So if you want to
  learn more about it you can refere to the following article :
  Herbert Bay, Tinne Tuytelaars and Luc Van Gool "SURF: Speeded Up
  Robust Features", Proceedings of the 9th European Conference on
  Computer Vision, Springer LNCS volume 3951, part 1, pp 404--417,
  2006.

  If you use this class the first things you have to do is to create
  the reference thanks to a reference image which contains the
  interesting object to detect. Then you have to grab other images
  containing the object. After calling the specific method to match
  points you can access to the lists of matched points thanks to the
  methods getMatchedPointsInReferenceImage() and
  getMatchedPointsInCurrentImage(). These two methods return a list of
  matched points. The nth element of the first list is matched with
  the nth element of the second list. The following small example show
  how to use the class.

  \code
#include <visp/vpConfig.h>
#include <visp/vpImage.h>
#include <visp/vpKeyPointSurf.h>

#if VISP_HAVE_OPENCV_VERSION >= 0x010100 // Surf key-points only available since OpenCV-1.1.0
int main()
{
  vpImage<unsigned char> Ireference;
  vpImage<unsigned char> Icurrent;
  vpKeyPointSurf surf;

  //First grab the reference image Ireference

  //Build the reference SURF points.
  surf.buildReference(Ireference);

  //Then grab another image which represents the current image Icurrent

  //Match points between the reference points and the SURF points computed in the current image.
  surf.matchPoint(Icurrent);

  //Display the matched points
  surf.display(Ireference, Icurrent);

  return (0);
}
#else
int main() {}
#endif
  \endcode

  It is also possible to create the reference thanks to only a part of the
  reference image (not the whole image) and find points to match in only a
  part of the current image. The small following example shows how to this

  \code
#include <visp/vpConfig.h>
#include <visp/vpImage.h>
#include <visp/vpDisplay.h>
#include <visp/vpKeyPointSurf.h>

#if VISP_HAVE_OPENCV_VERSION >= 0x010100 // Surf key-points only available since OpenCV-1.1.0
int main()
{
  vpImage<unsigned char> Ireference;
  vpImage<unsigned char> Icurrent;
  vpKeyPointSurf surf;

  //First grab the reference image Ireference

  //Select a part of the image by clincking on two points which define a rectangle
  vpImagePoint corners[2];
  for (int i=0 ; i < 2 ; i++)
  {
    vpDisplay::getClick(Ireference, corners[i]);
  }

  //Build the reference SURF points.
  int nbrRef;
  unsigned int height, width;
  height = (unsigned int)(corners[1].get_i() - corners[0].get_i());
  width = (unsigned int)(corners[1].get_j() - corners[0].get_j());
  nbrRef = surf.buildReference(Ireference, corners[0], height, width);

  //Then grab another image which represents the current image Icurrent

  //Select a part of the image by clincking on two points which define a rectangle
  for (int i=0 ; i < 2 ; i++)
  {
    vpDisplay::getClick(Icurrent, corners[i]);
  }

  //Match points between the reference points and the SURF points computed in the current image.
  int nbrMatched;
  height = (unsigned int)(corners[1].get_i() - corners[0].get_i());
  width = (unsigned int)(corners[1].get_j() - corners[0].get_j());
  nbrMatched = surf.matchPoint(Icurrent, corners[0], height, width);

  //Display the matched points
  surf.display(Ireference, Icurrent);

  return(0);
}
#else
int main() {}
#endif
  \endcode
*/

class VISP_EXPORT vpKeyPointSurf : public vpBasicKeyPoint
{
  public:
    /*!
      This enumerate enables to set the detail level of the
      descriptors.
    */
    typedef enum
    {
      basicDescriptor,   /*<! basicDescriptor means that the descriptors are
			   composed by 64 elements floating-point vector. */
      extendedDescriptor /*<! Means that the descriptors are composed by
			   128 elements floating-point vector. */
    } vpDescriptorType;

  public:
    vpKeyPointSurf();

    virtual ~vpKeyPointSurf(); 

    unsigned int buildReference(const vpImage<unsigned char> &I);
    unsigned int buildReference(const vpImage<unsigned char> &I,
                       const vpImagePoint &iP,
		       const unsigned int height, const unsigned int width);
    unsigned int buildReference(const vpImage<unsigned char> &I,
		       const vpRect& rectangle);
    unsigned int matchPoint(const vpImage<unsigned char> &I);
    unsigned int matchPoint(const vpImage<unsigned char> &I,
                   const vpImagePoint &iP, const unsigned int height, const unsigned int width);
    unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect& rectangle);
    void display(const vpImage<unsigned char> &Iref,
                 const vpImage<unsigned char> &Icurrent, unsigned int size=3);
    void display(const vpImage<unsigned char> &Icurrent, unsigned int size=3,
                 const vpColor &color=vpColor::green);
    std::list<int*>* matchPoint(std::list<float*> descriptorList, std::list<int> laplacianList);
    float* getDescriptorReferencePoint (const int index);
    int getLaplacianReferencePoint (const int index);
    void getDescriptorParamReferencePoint (const int index, int& size, float& dir);
    /*!

      Sets the value of the hessian threhold.  Note that during the
      computation of the hessian for each potential points, only the
      points which have a hessian value higher than the threshold are
      keeped.  Fore more details about the threshold see the article
      Herbert Bay, Tinne Tuytelaars and Luc Van Gool "SURF: Speeded Up
      Robust Features", Proceedings of the 9th European Conference on
      Computer Vision, Springer LNCS volume 3951, part 1, pp 404--417,
      2006.

      \param hessianThreshold : Desired hessian threshold value.
    */
    void setHessianThreshold (double hessianThreshold) {
			this->hessianThreshold = hessianThreshold;
			params = cvSURFParams(this->hessianThreshold, this->descriptorType);
    } ;

    /*!

      Sets the type of descriptors to use.

      \param descriptorType : Type of descriptor to use.
    */
    void setDescriptorType (vpDescriptorType descriptorType) {
			this->descriptorType = descriptorType;
			params = cvSURFParams(this->hessianThreshold, this->descriptorType);
    } ;

    /*!
      Gets the value of the hessian threhold.

      \return the hessian threshold value.
    */
    double getHessianThreshold () {return hessianThreshold;} ;

    /*!
      Gets the type of descriptor used.

      \return the type of descriptor used.
    */
    vpDescriptorType getDescriptorType () {return descriptorType;} ;

#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
    /*!
      @name Deprecated functions
    */
    vp_deprecated vpList<int*>* matchPoint(vpList<float*> descriptorList, vpList<int> laplacianList);
#endif

  private:
    void init();

  private:
    //OpenCV Parameters
    CvMemStorage* storage;
    CvSURFParams params;
    CvMemStorage* storage_cur;

    CvSeq* image_keypoints;
    CvSeq* image_descriptors;

    CvSeq* ref_keypoints;
    CvSeq* ref_descriptors;

    /*!
      only features with keypoint.hessian larger than that are extracted.
      Good default value is ~300-500 (can depend on the average
      local contrast and sharpness of the image).
      User can further filter out some features based on their hessian values
      and other characteristics.
    */
    double hessianThreshold;
    vpDescriptorType descriptorType;

};


#endif

#endif