dsift.h
Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
00009 All rights reserved.
00010 
00011 This file is part of the VLFeat library and is made available under
00012 the terms of the BSD license (see the COPYING file).
00013 */
00014 
00015 #ifndef VL_DSIFT_H
00016 #define VL_DSIFT_H
00017 
00018 #include "generic.h"
00019 
00021 typedef struct VlDsiftKeypoint_
00022 {
00023   double x ; 
00024   double y ; 
00025   double s ; 
00026   double norm ; 
00027 } VlDsiftKeypoint ;
00028 
00030 typedef struct VlDsiftDescriptorGeometry_
00031 {
00032   int numBinT ;  
00033   int numBinX ;  
00034   int numBinY ;  
00035   int binSizeX ; 
00036   int binSizeY ; 
00037 } VlDsiftDescriptorGeometry ;
00038 
00040 typedef struct VlDsiftFilter_
00041 {
00042   int imWidth ;            
00043   int imHeight ;           
00045   int stepX ;              
00046   int stepY ;              
00048   int boundMinX ;          
00049   int boundMinY ;          
00050   int boundMaxX ;          
00051   int boundMaxY ;          
00054   VlDsiftDescriptorGeometry geom ;
00055 
00056   int useFlatWindow ;      
00057   double windowSize ;      
00059   int numFrames ;          
00060   int descrSize ;          
00061   VlDsiftKeypoint *frames ; 
00062   float *descrs ;          
00064   int numBinAlloc ;        
00065   int numFrameAlloc ;      
00066   int numGradAlloc ;       
00068   float **grads ;          
00069   float *convTmp1 ;        
00070   float *convTmp2 ;        
00071 }  VlDsiftFilter ;
00072 
00073 VL_EXPORT VlDsiftFilter *vl_dsift_new (int width, int height) ;
00074 VL_EXPORT VlDsiftFilter *vl_dsift_new_basic (int width, int height, int step, int binSize) ;
00075 VL_EXPORT void vl_dsift_delete (VlDsiftFilter *self) ;
00076 VL_EXPORT void vl_dsift_process (VlDsiftFilter *self, float const* im) ;
00077 VL_INLINE void vl_dsift_transpose_descriptor (float* dst,
00078                                              float const* src,
00079                                              int numBinT,
00080                                              int numBinX,
00081                                              int numBinY) ;
00082 
00086 VL_INLINE void vl_dsift_set_steps (VlDsiftFilter *self,
00087                                   int stepX,
00088                                   int stepY) ;
00089 VL_INLINE void vl_dsift_set_bounds (VlDsiftFilter *self,
00090                                    int minX,
00091                                    int minY,
00092                                    int maxX,
00093                                    int maxY) ;
00094 VL_INLINE void vl_dsift_set_geometry (VlDsiftFilter *self,
00095                                       VlDsiftDescriptorGeometry const* geom) ;
00096 VL_INLINE void vl_dsift_set_flat_window (VlDsiftFilter *self, vl_bool useFlatWindow) ;
00097 VL_INLINE void vl_dsift_set_window_size (VlDsiftFilter *self, double windowSize) ;
00103 VL_INLINE float const    *vl_dsift_get_descriptors     (VlDsiftFilter const *self) ;
00104 VL_INLINE int             vl_dsift_get_descriptor_size (VlDsiftFilter const *self) ;
00105 VL_INLINE int             vl_dsift_get_keypoint_num    (VlDsiftFilter const *self) ;
00106 VL_INLINE VlDsiftKeypoint const *vl_dsift_get_keypoints (VlDsiftFilter const *self) ;
00107 VL_INLINE void            vl_dsift_get_bounds          (VlDsiftFilter const *self,
00108                                                        int* minX,
00109                                                        int* minY,
00110                                                        int* maxX,
00111                                                        int* maxY) ;
00112 VL_INLINE void            vl_dsift_get_steps           (VlDsiftFilter const* self,
00113                                                        int* stepX,
00114                                                        int* stepY) ;
00115 VL_INLINE VlDsiftDescriptorGeometry const* vl_dsift_get_geometry (VlDsiftFilter const *self) ;
00116 VL_INLINE vl_bool         vl_dsift_get_flat_window     (VlDsiftFilter const *self) ;
00117 VL_INLINE double          vl_dsift_get_window_size     (VlDsiftFilter const *self) ;
00120 VL_EXPORT
00121 void _vl_dsift_update_buffers (VlDsiftFilter *self) ;
00122 
00129 int
00130 vl_dsift_get_descriptor_size (VlDsiftFilter const *self)
00131 {
00132   return self->descrSize ;
00133 }
00134 
00141 float const *
00142 vl_dsift_get_descriptors (VlDsiftFilter const *self)
00143 {
00144   return self->descrs ;
00145 }
00146 
00152 VlDsiftKeypoint const *
00153 vl_dsift_get_keypoints (VlDsiftFilter const *self)
00154 {
00155   return self->frames ;
00156 }
00157 
00163 int
00164 vl_dsift_get_keypoint_num (VlDsiftFilter const *self)
00165 {
00166   return self->numFrames ;
00167 }
00168 
00175 VlDsiftDescriptorGeometry const* vl_dsift_get_geometry (VlDsiftFilter const *self)
00176 {
00177   return &self->geom ;
00178 }
00179 
00189 void
00190 vl_dsift_get_bounds (VlDsiftFilter const* self,
00191                     int *minX, int *minY, int *maxX, int *maxY)
00192 {
00193   *minX = self->boundMinX ;
00194   *minY = self->boundMinY ;
00195   *maxX = self->boundMaxX ;
00196   *maxY = self->boundMaxY ;
00197 }
00198 
00205 int
00206 vl_dsift_get_flat_window (VlDsiftFilter const* self)
00207 {
00208   return self->useFlatWindow ;
00209 }
00210 
00218 void
00219 vl_dsift_get_steps (VlDsiftFilter const* self,
00220                    int* stepX,
00221                    int* stepY)
00222 {
00223   *stepX = self->stepX ;
00224   *stepY = self->stepY ;
00225 }
00226 
00234 void
00235 vl_dsift_set_steps (VlDsiftFilter* self,
00236                    int stepX,
00237                    int stepY)
00238 {
00239   self->stepX = stepX ;
00240   self->stepY = stepY ;
00241   _vl_dsift_update_buffers(self) ;
00242 }
00243 
00253 void
00254 vl_dsift_set_bounds (VlDsiftFilter* self,
00255                     int minX, int minY, int maxX, int maxY)
00256 {
00257   self->boundMinX = minX ;
00258   self->boundMinY = minY ;
00259   self->boundMaxX = maxX ;
00260   self->boundMaxY = maxY ;
00261   _vl_dsift_update_buffers(self) ;
00262 }
00263 
00270 void
00271 vl_dsift_set_geometry (VlDsiftFilter *self,
00272                        VlDsiftDescriptorGeometry const *geom)
00273 {
00274   self->geom = *geom ;
00275   _vl_dsift_update_buffers(self) ;
00276 }
00277 
00284 void
00285 vl_dsift_set_flat_window (VlDsiftFilter* self,
00286                          vl_bool useFlatWindow)
00287 {
00288   self->useFlatWindow = useFlatWindow ;
00289 }
00290 
00306 VL_INLINE void
00307 vl_dsift_transpose_descriptor (float* dst,
00308                               float const* src,
00309                               int numBinT,
00310                               int numBinX,
00311                               int numBinY)
00312 {
00313   int t, x, y ;
00314 
00315   for (y = 0 ; y < numBinY ; ++y) {
00316     for (x = 0 ; x < numBinX ; ++x) {
00317       int offset  = numBinT * (x + y * numBinX) ;
00318       int offsetT = numBinT * (y + x * numBinY) ;
00319 
00320       for (t = 0 ; t < numBinT ; ++t) {
00321         int tT = numBinT / 4 - t ;
00322         dst [offsetT + (tT + numBinT) % numBinT] = src [offset + t] ;
00323       }
00324     }
00325   }
00326 }
00327 
00334 void
00335 vl_dsift_set_window_size(VlDsiftFilter * self, double windowSize)
00336 {
00337   assert(windowSize >= 0.0) ;
00338   self->windowSize = windowSize ;
00339 }
00340 
00347 VL_INLINE double
00348 vl_dsift_get_window_size(VlDsiftFilter const * self)
00349 {
00350   return self->windowSize ;
00351 }
00352 
00353 /*  VL_DSIFT_H */
00354 #endif


libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:51