00001
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef VL_MSER
00015 #define VL_MSER
00016
00017 #include "generic.h"
00018
00024 typedef vl_uint8 vl_mser_pix ;
00025
00030 #define VL_MSER_PIX_MAXVAL 256
00031
00032
00042 typedef struct _VlMserFilt VlMserFilt ;
00043
00045 typedef struct _VlMserStats VlMserStats ;
00046
00048 struct _VlMserStats
00049 {
00050 int num_extremal ;
00051 int num_unstable ;
00052 int num_abs_unstable ;
00053 int num_too_big ;
00054 int num_too_small ;
00055 int num_duplicates ;
00056 } ;
00057
00061 VL_EXPORT VlMserFilt* vl_mser_new (int ndims, int const* dims) ;
00062 VL_EXPORT void vl_mser_delete (VlMserFilt *f) ;
00068 VL_EXPORT void vl_mser_process (VlMserFilt *f,
00069 vl_mser_pix const *im) ;
00070 VL_EXPORT void vl_mser_ell_fit (VlMserFilt *f) ;
00076 VL_INLINE vl_uint vl_mser_get_regions_num (VlMserFilt const *f) ;
00077 VL_INLINE vl_uint const* vl_mser_get_regions (VlMserFilt const *f) ;
00078 VL_INLINE float const* vl_mser_get_ell (VlMserFilt const *f) ;
00079 VL_INLINE vl_uint vl_mser_get_ell_num (VlMserFilt const *f) ;
00080 VL_INLINE vl_uint vl_mser_get_ell_dof (VlMserFilt const *f) ;
00081 VL_INLINE VlMserStats const* vl_mser_get_stats (VlMserFilt const *f) ;
00087 VL_INLINE vl_mser_pix vl_mser_get_delta (VlMserFilt const *f) ;
00088 VL_INLINE double vl_mser_get_min_area (VlMserFilt const *f) ;
00089 VL_INLINE double vl_mser_get_max_area (VlMserFilt const *f) ;
00090 VL_INLINE double vl_mser_get_max_variation (VlMserFilt const *f) ;
00091 VL_INLINE double vl_mser_get_min_diversity (VlMserFilt const *f) ;
00097 VL_INLINE void vl_mser_set_delta (VlMserFilt *f, vl_mser_pix x) ;
00098 VL_INLINE void vl_mser_set_min_area (VlMserFilt *f, double x) ;
00099 VL_INLINE void vl_mser_set_max_area (VlMserFilt *f, double x) ;
00100 VL_INLINE void vl_mser_set_max_variation (VlMserFilt *f, double x) ;
00101 VL_INLINE void vl_mser_set_min_diversity (VlMserFilt *f, double x) ;
00104
00105
00106
00107
00115 typedef float vl_mser_acc ;
00116
00118 #ifdef VL_COMPILER_MSC
00119 #define VL_MSER_VOID_NODE ((1ui64<<32) - 1)
00120 #else
00121 #define VL_MSER_VOID_NODE ((1ULL<<32) - 1)
00122 #endif
00123
00124
00148 struct _VlMserReg
00149 {
00150 vl_uint parent ;
00151 vl_uint shortcut ;
00152 vl_uint height ;
00153 vl_uint area ;
00154 } ;
00155
00157 typedef struct _VlMserReg VlMserReg ;
00158
00159
00184 struct _VlMserExtrReg
00185 {
00186 int parent ;
00187 int index ;
00188 vl_mser_pix value ;
00189 vl_uint shortcut ;
00190 vl_uint area ;
00191 float variation ;
00192 vl_uint max_stable ;
00193 } ;
00194
00196 typedef struct _VlMserExtrReg VlMserExtrReg ;
00197
00198
00202 struct _VlMserFilt
00203 {
00204
00207 int ndims ;
00208 int *dims ;
00209 int nel ;
00210 int *subs ;
00211 int *dsubs ;
00212 int *strides ;
00214
00215 vl_uint *perm ;
00216 vl_uint *joins ;
00217 int njoins ;
00221 VlMserReg *r ;
00222 VlMserExtrReg *er ;
00223 vl_uint *mer ;
00224 int ner ;
00225 int nmer ;
00226 int rer ;
00227 int rmer ;
00229
00232 float *acc ;
00233 float *ell ;
00234 int rell ;
00235 int nell ;
00236 int dof ;
00239
00242 vl_bool verbose ;
00243 int delta ;
00244 double max_area ;
00245 double min_area ;
00246 double max_variation ;
00247 double min_diversity ;
00249
00250 VlMserStats stats ;
00251 } ;
00252
00253
00258 VL_INLINE vl_mser_pix
00259 vl_mser_get_delta (VlMserFilt const *f)
00260 {
00261 return f-> delta ;
00262 }
00263
00268 VL_INLINE void
00269 vl_mser_set_delta (VlMserFilt *f, vl_mser_pix x)
00270 {
00271 f-> delta = x ;
00272 }
00273
00274
00279 VL_INLINE double
00280 vl_mser_get_min_diversity (VlMserFilt const *f)
00281 {
00282 return f-> min_diversity ;
00283 }
00284
00289 VL_INLINE void
00290 vl_mser_set_min_diversity (VlMserFilt *f, double x)
00291 {
00292 f-> min_diversity = x ;
00293 }
00294
00295
00300 VL_INLINE VlMserStats const*
00301 vl_mser_get_stats (VlMserFilt const *f)
00302 {
00303 return & f-> stats ;
00304 }
00305
00306
00311 VL_INLINE double
00312 vl_mser_get_max_area (VlMserFilt const *f)
00313 {
00314 return f-> max_area ;
00315 }
00316
00321 VL_INLINE void
00322 vl_mser_set_max_area (VlMserFilt *f, double x)
00323 {
00324 f-> max_area = x ;
00325 }
00326
00327
00332 VL_INLINE double
00333 vl_mser_get_min_area (VlMserFilt const *f)
00334 {
00335 return f-> min_area ;
00336 }
00337
00342 VL_INLINE void
00343 vl_mser_set_min_area (VlMserFilt *f, double x)
00344 {
00345 f-> min_area = x ;
00346 }
00347
00348
00353 VL_INLINE double
00354 vl_mser_get_max_variation (VlMserFilt const *f)
00355 {
00356 return f-> max_variation ;
00357 }
00358
00363 VL_INLINE void
00364 vl_mser_set_max_variation (VlMserFilt *f, double x)
00365 {
00366 f-> max_variation = x ;
00367 }
00368
00369
00374 VL_INLINE vl_uint const *
00375 vl_mser_get_regions (VlMserFilt const* f)
00376 {
00377 return f-> mer ;
00378 }
00379
00384 VL_INLINE vl_uint
00385 vl_mser_get_regions_num (VlMserFilt const* f)
00386 {
00387 return f-> nmer ;
00388 }
00389
00390
00395 VL_INLINE float const *
00396 vl_mser_get_ell (VlMserFilt const* f)
00397 {
00398 return f-> ell ;
00399 }
00400
00405 VL_INLINE vl_uint
00406 vl_mser_get_ell_dof (VlMserFilt const* f)
00407 {
00408 return f-> dof ;
00409 }
00410
00415 VL_INLINE vl_uint
00416 vl_mser_get_ell_num (VlMserFilt const* f)
00417 {
00418 return f-> nell ;
00419 }
00420
00421
00422 #endif