Main MRPT website > C++ reference for MRPT 1.9.9
sift.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef SIFT_H
11 #define SIFT_H
12 
13 //#include "cxcore.h"
14 // Universal include for all versions of OpenCV
15 #include <mrpt/otherlibs/do_opencv_includes.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /******************************** Structures *********************************/
22 
23 /** holds feature data relevant to detection */
25 {
26  int r;
27  int c;
28  int octv;
29  int intvl;
30  double subintvl;
31  double scl_octv;
32 };
33 
34 struct feature;
35 
36 /******************************* Defs and macros *****************************/
37 
38 /** default number of sampled intervals per octave */
39 #define SIFT_INTVLS 3
40 
41 /** default sigma for initial gaussian smoothing */
42 #define SIFT_SIGMA 1.6
43 
44 /** default threshold on keypoint contrast |D(x)| */
45 //#define SIFT_CONTR_THR 0.04
46 
47 /** default threshold on keypoint ratio of principle curvatures */
48 //#define SIFT_CURV_THR 10
49 
50 /** double image size before pyramid construction? */
51 #define SIFT_IMG_DBL 1
52 
53 /** default width of descriptor histogram array */
54 #define SIFT_DESCR_WIDTH 4
55 
56 /** default number of bins per histogram in descriptor array */
57 #define SIFT_DESCR_HIST_BINS 8
58 
59 /* assumed gaussian blur for input image */
60 #define SIFT_INIT_SIGMA 0.5
61 
62 /* width of border in which to ignore keypoints */
63 #define SIFT_IMG_BORDER 5
64 
65 /* maximum steps of keypoint interpolation before failure */
66 #define SIFT_MAX_INTERP_STEPS 5
67 
68 /* default number of bins in histogram for orientation assignment */
69 #define SIFT_ORI_HIST_BINS 36
70 
71 /* determines gaussian sigma for orientation assignment */
72 #define SIFT_ORI_SIG_FCTR 1.5
73 
74 /* determines the radius of the region used in orientation assignment */
75 #define SIFT_ORI_RADIUS 3.0 * SIFT_ORI_SIG_FCTR
76 
77 /* number of passes of orientation histogram smoothing */
78 #define SIFT_ORI_SMOOTH_PASSES 2
79 
80 /* orientation magnitude relative to max that results in new feature */
81 #define SIFT_ORI_PEAK_RATIO 0.8
82 
83 /* determines the size of a single descriptor orientation histogram */
84 #define SIFT_DESCR_SCL_FCTR 3.0
85 
86 /* threshold on magnitude of elements of descriptor vector */
87 #define SIFT_DESCR_MAG_THR 0.2
88 
89 /* factor used to convert floating-point descriptor to unsigned char */
90 #define SIFT_INT_DESCR_FCTR 512.0
91 
92 /* returns a feature's detection data */
93 #define feat_detection_data(f) ((struct detection_data*)(f->feature_data))
94 
95 /*************************** Function Prototypes *****************************/
96 
97 /**
98 Finds SIFT features in an image using default parameter values. All
99 detected features are stored in the array pointed to by \a feat.
100 
101 @param img the image in which to detect features
102 @param feat a pointer to an array in which to store detected features
103 
104 @return Returns the number of features stored in \a feat or -1 on failure
105 @see _sift_features()
106 */
107 extern int sift_features(IplImage* img, struct feature** feat);
108 
109 /**
110 Finda SIFT features in an image using user-specified parameter values. All
111 detected features are stored in the array pointed to by \a feat.
112 
113 @param img the image in which to detect features
114 @param feat a pointer to an array in which to store detected features
115 @param intvls the number of intervals sampled per octave of scale space
116 @param sigma the amount of Gaussian smoothing applied to each image level
117  before building the scale space representation for an octave
118 @param contr_thr a threshold on the value of the scale space function
119  \f$\left|D(\hat{x})\right|\f$, where \f$\hat{x}\f$ is a vector specifying
120  feature location and scale, used to reject unstable features; assumes
121 pixel values in the range [0, 1]
122 @param curv_thr threshold on a feature's ratio of principle curvatures
123  used to reject features that are too edge-like
124 @param img_dbl should be 1 if image doubling prior to scale space
125  construction is desired or 0 if not
126 @param descr_width the width, \f$n\f$, of the \f$n \times n\f$ array of
127  orientation histograms used to compute a feature's descriptor
128 @param descr_hist_bins the number of orientations in each of the
129  histograms in the array used to compute a feature's descriptor
130 
131 @return Returns the number of keypoints stored in \a feat or -1 on failure
132 @see sift_features()
133 */
134 extern int _sift_features(
135  IplImage* img, struct feature** feat, int intvls, double sigma,
136  double contr_thr, int curv_thr, int img_dbl, int descr_width,
137  int descr_hist_bins);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif
int octv
Definition: sift.h:28
double subintvl
Definition: sift.h:30
int intvl
Definition: sift.h:29
GLint GLvoid * img
Definition: glext.h:3763
holds feature data relevant to detection
Definition: sift.h:24
Structure to represent an affine invariant image feature.
Definition: imgfeatures.h:49
int sift_features(IplImage *img, struct feature **feat)
Finds SIFT features in an image using default parameter values.
double scl_octv
Definition: sift.h:31
int _sift_features(IplImage *img, struct feature **feat, int intvls, double sigma, double contr_thr, int curv_thr, int img_dbl, int descr_width, int descr_hist_bins)
Finda SIFT features in an image using user-specified parameter values.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019