00001
00006
00007
00008
00009
00010
00011
00012
00013 #include <stdio.h>
00014
00015 #include "generic.h"
00016
00018 typedef float vl_sift_pix ;
00019
00027 typedef struct _VlSiftKeypoint
00028 {
00029 int o ;
00031 int ix ;
00032 int iy ;
00033 int is ;
00035 float x ;
00036 float y ;
00037 float s ;
00038 float sigma ;
00039 } VlSiftKeypoint ;
00040
00047 typedef struct _VlSiftFilt
00048 {
00049 double sigman ;
00050 double sigma0 ;
00051 double sigmak ;
00052 double dsigma0 ;
00054 int width ;
00055 int height ;
00056 int O ;
00057 int S ;
00058 int o_min ;
00059 int s_min ;
00060 int s_max ;
00061 int o_cur ;
00063 vl_sift_pix *temp ;
00064 vl_sift_pix *octave ;
00065 vl_sift_pix *dog ;
00066 int octave_width ;
00067 int octave_height ;
00069 VlSiftKeypoint* keys ;
00070 int nkeys ;
00071 int keys_res ;
00073 double peak_thresh ;
00074 double edge_thresh ;
00075 double norm_thresh ;
00076 double magnif ;
00078 vl_sift_pix *grad ;
00079 int grad_o ;
00081 } VlSiftFilt ;
00082
00086 VL_EXPORT
00087 VlSiftFilt* vl_sift_new (int width, int height,
00088 int noctaves, int nlevels,
00089 int o_min) ;
00090 VL_EXPORT
00091 void vl_sift_delete (VlSiftFilt *f) ;
00098 VL_EXPORT
00099 int vl_sift_process_first_octave (VlSiftFilt *f,
00100 vl_sift_pix const *im) ;
00101
00102 VL_EXPORT
00103 int vl_sift_process_next_octave (VlSiftFilt *f) ;
00104
00105 VL_EXPORT
00106 void vl_sift_detect (VlSiftFilt *f) ;
00107
00108 VL_EXPORT
00109 int vl_sift_calc_keypoint_orientations (VlSiftFilt *f,
00110 double angles [4],
00111 VlSiftKeypoint const*k);
00112 VL_EXPORT
00113 void vl_sift_calc_keypoint_descriptor (VlSiftFilt *f,
00114 vl_sift_pix *descr,
00115 VlSiftKeypoint const* k,
00116 double angle) ;
00117
00118 VL_EXPORT
00119 void vl_sift_calc_raw_descriptor (VlSiftFilt const *f,
00120 vl_sift_pix const* image,
00121 vl_sift_pix *descr,
00122 int widht, int height,
00123 double x, double y,
00124 double s, double angle0) ;
00125
00126 VL_EXPORT
00127 void vl_sift_keypoint_init (VlSiftFilt const *f,
00128 VlSiftKeypoint *k,
00129 double x,
00130 double y,
00131 double sigma) ;
00137 VL_INLINE int vl_sift_get_octave_index (VlSiftFilt const *f) ;
00138 VL_INLINE int vl_sift_get_noctaves (VlSiftFilt const *f) ;
00139 VL_INLINE int vl_sift_get_octave_first (VlSiftFilt const *f) ;
00140 VL_INLINE int vl_sift_get_octave_width (VlSiftFilt const *f) ;
00141 VL_INLINE int vl_sift_get_octave_height (VlSiftFilt const *f) ;
00142 VL_INLINE int vl_sift_get_nlevels (VlSiftFilt const *f) ;
00143 VL_INLINE int vl_sift_get_nkeypoints (VlSiftFilt const *f) ;
00144 VL_INLINE double vl_sift_get_peak_thresh (VlSiftFilt const *f) ;
00145 VL_INLINE double vl_sift_get_edge_thresh (VlSiftFilt const *f) ;
00146 VL_INLINE double vl_sift_get_norm_thresh (VlSiftFilt const *f) ;
00147 VL_INLINE double vl_sift_get_magnif (VlSiftFilt const *f) ;
00148
00149 VL_INLINE vl_sift_pix *vl_sift_get_octave (VlSiftFilt const *f, int s) ;
00150 VL_INLINE VlSiftKeypoint const *vl_sift_get_keypoints (VlSiftFilt const *f) ;
00156 VL_INLINE void vl_sift_set_peak_thresh (VlSiftFilt *f, double t) ;
00157 VL_INLINE void vl_sift_set_edge_thresh (VlSiftFilt *f, double t) ;
00158 VL_INLINE void vl_sift_set_norm_thresh (VlSiftFilt *f, double t) ;
00159 VL_INLINE void vl_sift_set_magnif (VlSiftFilt *f, double m) ;
00162
00163
00164
00165
00172 VL_INLINE int
00173 vl_sift_get_octave_index (VlSiftFilt const *f)
00174 {
00175 return f-> o_cur ;
00176 }
00177
00184 VL_INLINE int
00185 vl_sift_get_noctaves (VlSiftFilt const *f)
00186 {
00187 return f-> O ;
00188 }
00189
00196 VL_INLINE int
00197 vl_sift_get_octave_first (VlSiftFilt const *f)
00198 {
00199 return f-> o_min ;
00200 }
00201
00208 VL_INLINE int
00209 vl_sift_get_octave_width (VlSiftFilt const *f)
00210 {
00211 return f-> octave_width ;
00212 }
00213
00220 VL_INLINE int
00221 vl_sift_get_octave_height (VlSiftFilt const *f)
00222 {
00223 return f-> octave_height ;
00224 }
00225
00238 VL_INLINE vl_sift_pix *
00239 vl_sift_get_octave (VlSiftFilt const *f, int s)
00240 {
00241 int w = vl_sift_get_octave_width (f) ;
00242 int h = vl_sift_get_octave_height (f) ;
00243 return f->octave + w * h * (s - f->s_min) ;
00244 }
00245
00252 VL_INLINE int
00253 vl_sift_get_nlevels (VlSiftFilt const *f)
00254 {
00255 return f-> S ;
00256 }
00257
00264 VL_INLINE int
00265 vl_sift_get_nkeypoints (VlSiftFilt const *f)
00266 {
00267 return f-> nkeys ;
00268 }
00269
00276 VL_INLINE VlSiftKeypoint const *
00277 vl_sift_get_keypoints (VlSiftFilt const *f)
00278 {
00279 return f-> keys ;
00280 }
00281
00288 VL_INLINE double
00289 vl_sift_get_peak_thresh (VlSiftFilt const *f)
00290 {
00291 return f -> peak_thresh ;
00292 }
00293
00300 VL_INLINE double
00301 vl_sift_get_edge_thresh (VlSiftFilt const *f)
00302 {
00303 return f -> edge_thresh ;
00304 }
00305
00312 VL_INLINE double
00313 vl_sift_get_norm_thresh (VlSiftFilt const *f)
00314 {
00315 return f -> norm_thresh ;
00316 }
00317
00324 VL_INLINE double
00325 vl_sift_get_magnif (VlSiftFilt const *f)
00326 {
00327 return f -> magnif ;
00328 }
00329
00330
00337 VL_INLINE void
00338 vl_sift_set_peak_thresh (VlSiftFilt *f, double t)
00339 {
00340 f -> peak_thresh = t ;
00341 }
00342
00349 VL_INLINE void
00350 vl_sift_set_edge_thresh (VlSiftFilt *f, double t)
00351 {
00352 f -> edge_thresh = t ;
00353 }
00354
00361 VL_INLINE void
00362 vl_sift_set_norm_thresh (VlSiftFilt *f, double t)
00363 {
00364 f -> norm_thresh = t ;
00365 }
00366
00373 VL_INLINE void
00374 vl_sift_set_magnif (VlSiftFilt *f, double m)
00375 {
00376 f -> magnif = m ;
00377 }