#include "generic.h"
Go to the source code of this file.
Data Structures | |
struct | _VlMserStats |
MSER filter statistics definition. More... | |
struct | _VlMserReg |
MSER: basic region (declaration). More... | |
struct | _VlMserExtrReg |
MSER: extremal region (declaration). More... | |
struct | _VlMserFilt |
MSER filter. More... | |
Defines | |
#define | VL_MSER_PIX_MAXVAL 256 |
Maximum value. | |
#define | VL_MSER_VOID_NODE ((1ULL<<32) - 1) |
Basic region flag: null region. | |
Typedefs | |
typedef vl_uint8 | vl_mser_pix |
MSER image data type. | |
typedef struct _VlMserFilt | VlMserFilt |
MSER Filter. | |
typedef struct _VlMserStats | VlMserStats |
MSER filter statistics. | |
typedef vl_single | vl_mser_acc |
MSER accumulator data type. | |
typedef struct _VlMserReg | VlMserReg |
MSER: basic region. | |
typedef struct _VlMserExtrReg | VlMserExtrReg |
MSER: etremal region. | |
Functions | |
Construction and Destruction | |
VlMserFilt * | vl_mser_new (int ndims, int const *dims) |
Create a new MSER filter. | |
void | vl_mser_delete (VlMserFilt *f) |
Delete MSER filter. | |
Processing | |
void | vl_mser_process (VlMserFilt *f, vl_mser_pix const *im) |
Process image. | |
void | vl_mser_ell_fit (VlMserFilt *f) |
Fit ellipsoids. | |
Retrieving data | |
VL_INLINE vl_uint | vl_mser_get_regions_num (VlMserFilt const *f) |
Get number of maximally stable extremal regions. | |
VL_INLINE vl_uint const * | vl_mser_get_regions (VlMserFilt const *f) |
Get maximally stable extremal regions. | |
VL_INLINE vl_single const * | vl_mser_get_ell (VlMserFilt const *f) |
Get ellipsoids. | |
VL_INLINE vl_uint | vl_mser_get_ell_num (VlMserFilt const *f) |
Get number of ellipsoids. | |
VL_INLINE vl_uint | vl_mser_get_ell_dof (VlMserFilt const *f) |
Get number of degrees of freedom of ellipsoids. | |
VL_INLINE VlMserStats const * | vl_mser_get_stats (VlMserFilt const *f) |
Get statistics. | |
Retrieving parameters | |
VL_INLINE vl_mser_pix | vl_mser_get_delta (VlMserFilt const *f) |
Get delta. | |
VL_INLINE double | vl_mser_get_min_area (VlMserFilt const *f) |
Get minimum region area. | |
VL_INLINE double | vl_mser_get_max_area (VlMserFilt const *f) |
Get maximum region area. | |
VL_INLINE double | vl_mser_get_max_variation (VlMserFilt const *f) |
Get maximum region variation. | |
VL_INLINE double | vl_mser_get_min_diversity (VlMserFilt const *f) |
Get minimum diversity. | |
Setting parameters | |
VL_INLINE void | vl_mser_set_delta (VlMserFilt *f, vl_mser_pix x) |
Set delta. | |
VL_INLINE void | vl_mser_set_min_area (VlMserFilt *f, double x) |
Set minimum region area. | |
VL_INLINE void | vl_mser_set_max_area (VlMserFilt *f, double x) |
Set maximum region area. | |
VL_INLINE void | vl_mser_set_max_variation (VlMserFilt *f, double x) |
Set maximum region variation. | |
VL_INLINE void | vl_mser_set_min_diversity (VlMserFilt *f, double x) |
Set minimum diversity. |
For each intenstiy , one has multiple disjoint extremal regions in the level set
. Let
span a finite number of values
(a sampling of the image range). One obtains a family of regions
; by connecting two regions
and
if, and only if,
, regions form a tree:
The maximally stable extremal regions are extremal regions which satisfy a stability criterion. Here we use a criterion which is similar but not identical to the original paper. This definition is somewhat simpler both to understand and code (it also runs faster).
Let be the branch of the tree rooted at
. We associate to the branch the (in)stability score
The score is low if the regions along the branch have similar area (and thus similar shape). We aim to select maximally stable branches; then a maximally stable region is just a representative region selected from a maximally stable branch (for simplicity we select , but one could choose for example
).
Roughly speaking, a branch is maximally stable if it is a local minimum of the (in)stability score. More accurately, we start by assuming that all branches are maximally stable. Then we consider each branch and its parent branch
(notice that, due to the discrete nature of the calculations, they might be geometrically identical) and we mark as unstble the less stable one, i.e.:
This criterion selects among nearby regions the one that are more stable. We optionally refine the selection by running (starting from the bigger and going to the smaller regions) the following tests:
parameter | alt. name | standard value | set by |
![]() | delta | 5 | vl_mser_set_delta() |
![]() | max_area | 0.75 | vl_mser_set_max_area() |
![]() | min_area | 3.0/![]() | vl_mser_set_min_area() |
![]() | max_var | 0.25 | vl_mser_set_max_variation() |
![]() | min_diversity | 0.2 | vl_mser_set_min_diversity() |
Ellipsoids are fitted by vl_mser_ell_fit(). Notice that for a n dimensional image, the mean has n components and the variance has n(n+1)/2 independent components. The total number of componetns is obtained by vl_mser_get_ell_dof() and the total number of fitted ellipsoids by vl_mser_get_ell_num(). A matrix with an ellipsoid per column is returned by vl_mser_get_ell(). The column is the stacking of the mean and of the independet compontents of the variance, in the order (1,1),(1,2),..,(1,n), (2,2),(2,3).... In the caluclations, the pixel coordinate use the stanadard index order and ranges.
#define VL_MSER_PIX_MAXVAL 256 |
Maximum value of the integer type vl_mser_pix.
#define VL_MSER_VOID_NODE ((1ULL<<32) - 1) |
For internal use only.
typedef vl_single vl_mser_acc |
For internal use only.
This is a large integer type. It should be large enough to contain a number equal to the area (volume) of the image by the image widht by the image height (for instance, if the image is a square of side 256, the maximum value is 256 x 256 x 256).
typedef vl_uint8 vl_mser_pix |
This is the data type of the image pixels. It has to be an integer.
typedef struct _VlMserExtrReg VlMserExtrReg |
For internal use only.
typedef struct _VlMserFilt VlMserFilt |
The MSER filter computes the Maximally Stable Extremal Regions of an image.
This structure is opaque.
typedef struct _VlMserReg VlMserReg |
For internal use only.
void vl_mser_delete | ( | VlMserFilt * | f | ) |
The function releases the MSER filter f and all its resources.
f | MSER filter to be deleted. |
void vl_mser_ell_fit | ( | VlMserFilt * | f | ) |
VL_INLINE vl_mser_pix vl_mser_get_delta | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
delta
. VL_INLINE vl_single const * vl_mser_get_ell | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE vl_uint vl_mser_get_ell_dof | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE vl_uint vl_mser_get_ell_num | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE double vl_mser_get_max_area | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE double vl_mser_get_max_variation | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE double vl_mser_get_min_area | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE double vl_mser_get_min_diversity | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
minimum
diversity. VL_INLINE vl_uint const * vl_mser_get_regions | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE vl_uint vl_mser_get_regions_num | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VL_INLINE VlMserStats const * vl_mser_get_stats | ( | VlMserFilt const * | f | ) |
f | MSER filter. |
VlMserFilt* vl_mser_new | ( | int | ndims, | |
int const * | dims | |||
) |
Initializes a new MSER filter for images of the specified dimensions. Images are ndims -dimensional arrays of dimensions dims.
ndims | number of dimensions. | |
dims | dimensions. |
void vl_mser_process | ( | VlMserFilt * | f, | |
vl_mser_pix const * | im | |||
) |
The functions calculates the Maximally Stable Extremal Regions (MSERs) of image im using the MSER filter f.
The filter f must have been initialized to be compatible with the dimensions of im.
f | MSER filter. | |
im | image data. |
VL_INLINE void vl_mser_set_delta | ( | VlMserFilt * | f, | |
vl_mser_pix | x | |||
) |
f | MSER filter. | |
x | value of delta . |
VL_INLINE void vl_mser_set_max_area | ( | VlMserFilt * | f, | |
double | x | |||
) |
f | MSER filter. | |
x | maximum region area. |
VL_INLINE void vl_mser_set_max_variation | ( | VlMserFilt * | f, | |
double | x | |||
) |
f | MSER filter. | |
x | maximum region variation. |
VL_INLINE void vl_mser_set_min_area | ( | VlMserFilt * | f, | |
double | x | |||
) |
f | MSER filter. | |
x | minimum region area. |
VL_INLINE void vl_mser_set_min_diversity | ( | VlMserFilt * | f, | |
double | x | |||
) |
f | MSER filter. | |
x | value of minimum diversity. |