00001
00006
00007
00008 #include <stdio.h>
00009
00010 #include "generic.h"
00011
00013 typedef vl_single vl_sift_pix ;
00014
00022 typedef struct _VlSiftKeypoint
00023 {
00024 int o ;
00026 int ix ;
00027 int iy ;
00028 int is ;
00030 vl_single x ;
00031 vl_single y ;
00032 vl_single s ;
00033 vl_single sigma ;
00034 } VlSiftKeypoint ;
00035
00042 typedef struct _VlSiftFilt
00043 {
00044 double sigman ;
00045 double sigma0 ;
00046 double sigmak ;
00047 double dsigma0 ;
00049 int width ;
00050 int height ;
00051 int O ;
00052 int S ;
00053 int o_min ;
00054 int s_min ;
00055 int s_max ;
00056 int o_cur ;
00058 vl_sift_pix *temp ;
00059 vl_sift_pix *octave ;
00060 vl_sift_pix *dog ;
00061 int octave_width ;
00062 int octave_height ;
00064 VlSiftKeypoint* keys ;
00065 int nkeys ;
00066 int keys_res ;
00068 double peak_thresh ;
00069 double edge_thresh ;
00070 double norm_thresh ;
00072 vl_sift_pix *grad ;
00073 int grad_o ;
00075 } VlSiftFilt ;
00076
00077
00081 VlSiftFilt* vl_sift_new (int width, int height,
00082 int O, int S,
00083 int o_min) ;
00084 void vl_sift_delete (VlSiftFilt *f) ;
00090 int vl_sift_process_first_octave (VlSiftFilt *f,
00091 vl_sift_pix const *im) ;
00092 int vl_sift_process_next_octave (VlSiftFilt *f) ;
00093 void vl_sift_detect (VlSiftFilt *f) ;
00094 int vl_sift_calc_keypoint_orientations (VlSiftFilt *f,
00095 double angles [4],
00096 VlSiftKeypoint const*k);
00097 void vl_sift_calc_keypoint_descriptor (VlSiftFilt *f,
00098 vl_sift_pix *descr,
00099 VlSiftKeypoint const* k,
00100 double angle) ;
00101 void vl_sift_keypoint_init (VlSiftFilt const *f,
00102 VlSiftKeypoint *k,
00103 double x,
00104 double y,
00105 double sigma) ;
00111 VL_INLINE int vl_sift_get_octave_index (VlSiftFilt const *f) ;
00112 VL_INLINE int vl_sift_get_octave_num (VlSiftFilt const *f) ;
00113 VL_INLINE int vl_sift_get_octave_first (VlSiftFilt const *f) ;
00114 VL_INLINE int vl_sift_get_octave_width (VlSiftFilt const *f) ;
00115 VL_INLINE int vl_sift_get_octave_height (VlSiftFilt const *f) ;
00116 VL_INLINE int vl_sift_get_level_num (VlSiftFilt const *f) ;
00117 VL_INLINE int vl_sift_get_keypoints_num (VlSiftFilt const *f) ;
00118 VL_INLINE double vl_sift_get_peak_thresh (VlSiftFilt const *f) ;
00119 VL_INLINE double vl_sift_get_edge_thresh (VlSiftFilt const *f) ;
00120 VL_INLINE double vl_sift_get_norm_thresh (VlSiftFilt const *f) ;
00121
00122 VL_INLINE vl_sift_pix *vl_sift_get_octave (VlSiftFilt const *f, int s) ;
00123 VL_INLINE VlSiftKeypoint const *vl_sift_get_keypoints (VlSiftFilt const *f) ;
00129 VL_INLINE void vl_sift_set_peak_thresh (VlSiftFilt *f, double t) ;
00130 VL_INLINE void vl_sift_set_edge_thresh (VlSiftFilt *f, double t) ;
00131 VL_INLINE void vl_sift_set_norm_thresh (VlSiftFilt *f, double t) ;
00134
00135
00136
00137
00144 VL_INLINE int
00145 vl_sift_get_octave_index (VlSiftFilt const *f)
00146 {
00147 return f-> o_cur ;
00148 }
00149
00156 VL_INLINE int
00157 vl_sift_get_octave_num (VlSiftFilt const *f)
00158 {
00159 return f-> O ;
00160 }
00161
00168 VL_INLINE int
00169 vl_sift_get_octave_first (VlSiftFilt const *f)
00170 {
00171 return f-> o_min ;
00172 }
00173
00180 VL_INLINE int
00181 vl_sift_get_octave_width (VlSiftFilt const *f)
00182 {
00183 return f-> octave_width ;
00184 }
00185
00192 VL_INLINE int
00193 vl_sift_get_octave_height (VlSiftFilt const *f)
00194 {
00195 return f-> octave_height ;
00196 }
00197
00210 VL_INLINE vl_sift_pix *
00211 vl_sift_get_octave (VlSiftFilt const *f, int s)
00212 {
00213 int w = vl_sift_get_octave_width (f) ;
00214 int h = vl_sift_get_octave_height (f) ;
00215 return f->octave + w * h * (s - f->s_min) ;
00216 }
00217
00224 VL_INLINE int
00225 vl_sift_get_level_num (VlSiftFilt const *f)
00226 {
00227 return f-> S ;
00228 }
00229
00236 VL_INLINE int
00237 vl_sift_get_keypoints_num (VlSiftFilt const *f)
00238 {
00239 return f-> nkeys ;
00240 }
00241
00248 VL_INLINE VlSiftKeypoint const *
00249 vl_sift_get_keypoints (VlSiftFilt const *f)
00250 {
00251 return f-> keys ;
00252 }
00253
00260 VL_INLINE double
00261 vl_sift_get_peak_thresh (VlSiftFilt const *f)
00262 {
00263 return f -> peak_thresh ;
00264 }
00265
00272 VL_INLINE double
00273 vl_sift_get_edge_thresh (VlSiftFilt const *f)
00274 {
00275 return f -> edge_thresh ;
00276 }
00277
00284 VL_INLINE double
00285 vl_sift_get_norm_thresh (VlSiftFilt const *f)
00286 {
00287 return f -> norm_thresh ;
00288 }
00289
00296 VL_INLINE void
00297 vl_sift_set_peak_thresh (VlSiftFilt *f, double t)
00298 {
00299 f -> peak_thresh = t ;
00300 }
00301
00308 VL_INLINE void
00309 vl_sift_set_edge_thresh (VlSiftFilt *f, double t)
00310 {
00311 f -> edge_thresh = t ;
00312 }
00313
00320 VL_INLINE void
00321 vl_sift_set_norm_thresh (VlSiftFilt *f, double t)
00322 {
00323 f -> norm_thresh = t ;
00324 }