00001
00007
00008
00009 #ifndef VL_MSER
00010 #define VL_MSER
00011
00012 #include "generic.h"
00013
00019 typedef vl_uint8 vl_mser_pix ;
00020
00025 #define VL_MSER_PIX_MAXVAL 256
00026
00027
00037 typedef struct _VlMserFilt VlMserFilt ;
00038
00040 typedef struct _VlMserStats VlMserStats ;
00041
00043 struct _VlMserStats
00044 {
00045 int num_extremal ;
00046 int num_unstable ;
00047 int num_abs_unstable ;
00048 int num_too_big ;
00049 int num_too_small ;
00050 int num_duplicates ;
00051 } ;
00052
00056 VlMserFilt* vl_mser_new (int ndims, int const* dims) ;
00057 void vl_mser_delete (VlMserFilt *f) ;
00063 void vl_mser_process (VlMserFilt *f,
00064 vl_mser_pix const *im) ;
00065 void vl_mser_ell_fit (VlMserFilt *f) ;
00071 VL_INLINE vl_uint vl_mser_get_regions_num (VlMserFilt const *f) ;
00072 VL_INLINE vl_uint const* vl_mser_get_regions (VlMserFilt const *f) ;
00073 VL_INLINE vl_single const* vl_mser_get_ell (VlMserFilt const *f) ;
00074 VL_INLINE vl_uint vl_mser_get_ell_num (VlMserFilt const *f) ;
00075 VL_INLINE vl_uint vl_mser_get_ell_dof (VlMserFilt const *f) ;
00076 VL_INLINE VlMserStats const* vl_mser_get_stats (VlMserFilt const *f) ;
00082 VL_INLINE vl_mser_pix vl_mser_get_delta (VlMserFilt const *f) ;
00083 VL_INLINE double vl_mser_get_min_area (VlMserFilt const *f) ;
00084 VL_INLINE double vl_mser_get_max_area (VlMserFilt const *f) ;
00085 VL_INLINE double vl_mser_get_max_variation (VlMserFilt const *f) ;
00086 VL_INLINE double vl_mser_get_min_diversity (VlMserFilt const *f) ;
00092 VL_INLINE void vl_mser_set_delta (VlMserFilt *f, vl_mser_pix x) ;
00093 VL_INLINE void vl_mser_set_min_area (VlMserFilt *f, double x) ;
00094 VL_INLINE void vl_mser_set_max_area (VlMserFilt *f, double x) ;
00095 VL_INLINE void vl_mser_set_max_variation (VlMserFilt *f, double x) ;
00096 VL_INLINE void vl_mser_set_min_diversity (VlMserFilt *f, double x) ;
00099
00100
00101
00102
00110 typedef vl_single vl_mser_acc ;
00111
00113 #define VL_MSER_VOID_NODE ((1ULL<<32) - 1)
00114
00115
00139 struct _VlMserReg
00140 {
00141 vl_uint parent ;
00142 vl_uint shortcut ;
00143 vl_uint height ;
00144 vl_uint area ;
00145 } ;
00146
00148 typedef struct _VlMserReg VlMserReg ;
00149
00150
00175 struct _VlMserExtrReg
00176 {
00177 int parent ;
00178 int index ;
00179 vl_mser_pix value ;
00180 vl_uint shortcut ;
00181 vl_uint area ;
00182 vl_single variation ;
00183 vl_uint max_stable ;
00184 } ;
00185
00187 typedef struct _VlMserExtrReg VlMserExtrReg ;
00188
00189
00193 struct _VlMserFilt
00194 {
00195
00198 int ndims ;
00199 int *dims ;
00200 int nel ;
00201 int *subs ;
00202 int *dsubs ;
00203 int *strides ;
00205
00206 vl_uint *perm ;
00207 vl_uint *joins ;
00208 int njoins ;
00212 VlMserReg *r ;
00213 VlMserExtrReg *er ;
00214 vl_uint *mer ;
00215 int ner ;
00216 int nmer ;
00217 int rer ;
00218 int rmer ;
00220
00223 vl_single *acc ;
00224 vl_single *ell ;
00225 int rell ;
00226 int nell ;
00227 int dof ;
00230
00233 vl_bool verbose ;
00234 int delta ;
00235 double max_area ;
00236 double min_area ;
00237 double max_variation ;
00238 double min_diversity ;
00240
00241 VlMserStats stats ;
00242 } ;
00243
00244
00249 VL_INLINE vl_mser_pix
00250 vl_mser_get_delta (VlMserFilt const *f)
00251 {
00252 return f-> delta ;
00253 }
00254
00259 VL_INLINE void
00260 vl_mser_set_delta (VlMserFilt *f, vl_mser_pix x)
00261 {
00262 f-> delta = x ;
00263 }
00264
00265
00270 VL_INLINE double
00271 vl_mser_get_min_diversity (VlMserFilt const *f)
00272 {
00273 return f-> min_diversity ;
00274 }
00275
00280 VL_INLINE void
00281 vl_mser_set_min_diversity (VlMserFilt *f, double x)
00282 {
00283 f-> min_diversity = x ;
00284 }
00285
00286
00291 VL_INLINE VlMserStats const*
00292 vl_mser_get_stats (VlMserFilt const *f)
00293 {
00294 return & f-> stats ;
00295 }
00296
00297
00302 VL_INLINE double
00303 vl_mser_get_max_area (VlMserFilt const *f)
00304 {
00305 return f-> max_area ;
00306 }
00307
00312 VL_INLINE void
00313 vl_mser_set_max_area (VlMserFilt *f, double x)
00314 {
00315 f-> max_area = x ;
00316 }
00317
00318
00323 VL_INLINE double
00324 vl_mser_get_min_area (VlMserFilt const *f)
00325 {
00326 return f-> min_area ;
00327 }
00328
00333 VL_INLINE void
00334 vl_mser_set_min_area (VlMserFilt *f, double x)
00335 {
00336 f-> min_area = x ;
00337 }
00338
00339
00344 VL_INLINE double
00345 vl_mser_get_max_variation (VlMserFilt const *f)
00346 {
00347 return f-> max_variation ;
00348 }
00349
00354 VL_INLINE void
00355 vl_mser_set_max_variation (VlMserFilt *f, double x)
00356 {
00357 f-> max_variation = x ;
00358 }
00359
00360
00365 VL_INLINE vl_uint const *
00366 vl_mser_get_regions (VlMserFilt const* f)
00367 {
00368 return f-> mer ;
00369 }
00370
00375 VL_INLINE vl_uint
00376 vl_mser_get_regions_num (VlMserFilt const* f)
00377 {
00378 return f-> nmer ;
00379 }
00380
00381
00386 VL_INLINE vl_single const *
00387 vl_mser_get_ell (VlMserFilt const* f)
00388 {
00389 return f-> ell ;
00390 }
00391
00396 VL_INLINE vl_uint
00397 vl_mser_get_ell_dof (VlMserFilt const* f)
00398 {
00399 return f-> dof ;
00400 }
00401
00406 VL_INLINE vl_uint
00407 vl_mser_get_ell_num (VlMserFilt const* f)
00408 {
00409 return f-> nell ;
00410 }
00411
00412
00413 #endif