source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/SURF-V1.0.8_Original/surflib.h @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 4.4 KB
Line 
1/*
2 * Speeded-Up Robust Features (SURF)
3 * http://people.ee.ethz.ch/~surf
4 *
5 * Authors: Herbert Bay, Andreas Ess, Geert Willems
6 * Windows port by Stefan Saur
7 *
8 * Copyright (2006): ETH Zurich, Switzerland
9 * Katholieke Universiteit Leuven, Belgium
10 * All rights reserved.
11 *
12 * For details, see the paper:
13 * Herbert Bay,  Tinne Tuytelaars,  Luc Van Gool,
14 *  "SURF: Speeded Up Robust Features"
15 * Proceedings of the ninth European Conference on Computer Vision, May 2006
16 *
17 * Permission to use, copy, modify, and distribute this software and
18 * its documentation for educational, research, and non-commercial
19 * purposes, without fee and without a signed licensing agreement, is
20 * hereby granted, provided that the above copyright notice and this
21 * paragraph appear in all copies modifications, and distributions.
22 *
23 * Any commercial use or any redistribution of this software
24 * requires a license from one of the above mentioned establishments.
25 *
26 * For further details, contact Andreas Ess (aess@vision.ee.ethz.ch).
27 */
28
29/**
30 * SURF library functions
31 **/
32
33#ifndef __SURFLIB_H
34#define __SURFLIB_H
35
36#include "ipoint.h"
37#include "fasthessian.h"
38#include "surf.h"
39#include "image.h"
40
41namespace surf {
42
43/**
44 * Identify interest points and calculate their descriptor
45 *
46 * @param im pointer to double image
47 * @param ipts (return) vector of interest points
48 * @param thres blob response threshold
49 * @param doubleImageSize double image size
50 * @param initLobe custom lobe size
51 * @param samplingStep initial sampling step
52 * @param octaves number of octaves
53 * @param upright true to switch off rotation invariance
54 * @param extended true for SURF-128 instead of SURF-64
55 * @param indexSize descriptor size
56 **/
57inline void surfDetDes(Image *im, std::vector< Ipoint >& ipts,
58                                double thres = 4.0, bool doubleImageSize = false,
59                                int initLobe = 3, int samplingStep = 2, int octaves = 4,
60                                bool upright = false, bool extended = false, int indexSize = 4) {
61  // Create the integral image
62  Image iimage(im, doubleImageSize);
63
64  // Extract interest points with Fast-Hessian
65  FastHessian fh(&iimage, /* pointer to integral image */
66                 ipts, /* interest point vector to be filled */
67                 thres, /* blob response threshold */
68                 doubleImageSize, /* double image size flag */
69                 initLobe * 3 /* 3 times lobe size equals the mask size */, 
70                 samplingStep, /* subsample the blob response map */
71                 octaves /* number of octaves to be analysed */);
72
73  // Extract them and get their pointer
74  fh.getInterestPoints();
75
76  // Initialise the SURF descriptor
77  Surf des(&iimage, /* pointer to integral image */ 
78           doubleImageSize, /* double image size flag */ 
79           upright, /* rotation invariance or upright */
80           extended, /* use the extended descriptor */
81           indexSize /* square size of the descriptor window (default 4x4)*/);
82
83  // Compute the orientation and the descriptor for every interest point
84  for (unsigned n=0; n<ipts.size(); n++){
85    // set the current interest point
86    des.setIpoint(&ipts[n]);
87    // assign reproducible orientation
88    des.assignOrientation();
89    // make the SURF descriptor
90    des.makeDescriptor();
91  }
92}
93
94/**
95 * Calculate descriptor for given interest points
96 *
97 * @param im pointer to double image
98 * @param ipts (return) vector of interest points
99 * @param doubleImageSize double image size
100 * @param upright true to switch off rotation invariance
101 * @param extended true for SURF-128 instead of SURF-64
102 * @param indexSize descriptor size
103 **/
104inline void surfDes(Image *im, std::vector< Ipoint >& ipts,
105                         bool doubleImageSize = false,
106                         bool upright = false, bool extended = false, int indexSize = 4) {
107  // Create the integral image
108  Image iimage(im, doubleImageSize);
109
110  // Initialise the SURF descriptor
111  Surf des(&iimage, /* pointer to integral image */ 
112           doubleImageSize, /* double image size flag */ 
113           upright, /* rotation invariance or upright */
114           extended, /* use the extended descriptor */
115           indexSize /* square size of the descriptor window (default 4x4)*/);
116
117  // Compute the orientation and the descriptor for every interest point
118  for (unsigned n=0; n<ipts.size(); n++){
119    //for (Ipoint *k = ipts; k != NULL; k = k->next){
120    // set the current interest point
121    des.setIpoint(&ipts[n]);
122    // assign reproducible orientation
123    des.assignOrientation();
124    // make the SURF descriptor
125    des.makeDescriptor();
126  }
127}
128
129}
130
131#endif
Note: See TracBrowser for help on using the repository browser.