dhog.h
Go to the documentation of this file.00001 00006 /* AUTORIGHTS 00007 Copyright 2007 (c) Andrea Vedaldi and Brian Fulkerson 00008 00009 This file is part of VLFeat, available in the terms of the GNU 00010 General Public License version 2. 00011 */ 00012 00013 #ifndef VL_DHOG_H 00014 #define VL_DHOG_H 00015 00016 #include "generic.h" 00017 00019 typedef struct VlDhogKeypoint_ 00020 { 00021 double x ; 00022 double y ; 00023 double s ; 00024 double norm ; 00025 } VlDhogKeypoint ; 00026 00028 typedef struct VlDhogFilter_ 00029 { 00030 int width ; 00031 int height ; 00032 int sampling_step ; 00033 int bin_size ; 00034 int fast ; 00036 int dwidth ; 00037 int dheight ; 00039 float **hist ; 00040 float *tmp ; 00041 float *tmp2 ; 00042 float *descr ; 00043 VlDhogKeypoint *keys ; 00044 int nkeys ; 00045 } VlDhogFilter ; 00046 00047 VL_EXPORT VlDhogFilter *vl_dhog_new (int width, int height, int sampling_step, int bin_size) ; 00048 VL_EXPORT void vl_dhog_delete (VlDhogFilter *f) ; 00049 VL_EXPORT void vl_dhog_process (VlDhogFilter *f, float const* im, vl_bool fast) ; 00050 00054 VL_INLINE float *vl_dhog_get_descriptors (VlDhogFilter *f) ; 00055 VL_INLINE int vl_dhog_get_keypoint_num (VlDhogFilter *f) ; 00056 VL_INLINE VlDhogKeypoint *vl_dhog_get_keypoints (VlDhogFilter *f) ; 00057 VL_INLINE void vl_dhog_transpose_descriptor (float* dst, float const* src) ; 00066 float * 00067 vl_dhog_get_descriptors (VlDhogFilter *f) 00068 { 00069 return f->descr ; 00070 } 00071 00077 VlDhogKeypoint * 00078 vl_dhog_get_keypoints (VlDhogFilter *f) 00079 { 00080 return f->keys ; 00081 } 00082 00088 int 00089 vl_dhog_get_keypoint_num (VlDhogFilter *f) 00090 { 00091 return f->nkeys ; 00092 } 00093 00094 00107 VL_INLINE void 00108 vl_dhog_transpose_descriptor (float* dst, float const* src) 00109 { 00110 int const BO = 8 ; /* number of orientation bins */ 00111 int const BP = 4 ; /* number of spatial bins */ 00112 int i, j, t ; 00113 00114 for (j = 0 ; j < BP ; ++j) { 00115 for (i = 0 ; i < BP ; ++i) { 00116 int o = BO * i + BP*BO * j ; 00117 int op = BO * j + BP*BO * i ; 00118 for (t = 0 ; t < BO ; ++t) 00119 dst [op+((BO/4+BO) -t)%BO] = src [o+t] ; 00120 } 00121 } 00122 } 00123 00124 /* VL_DHOG_H */ 00125 #endif