Skip to content

MSER

Features and matchingclassOpenCV 5.0.0
import { MSER } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits Feature2D.

example: samples/python/snippets/mser.py An example using Maximally stable extremal region(MSER) extractor in python Maximally stable extremal region extractor

The class encapsulates all the parameters of the %MSER extraction algorithm (see wiki article).

  • there are two different implementation of %MSER: one for grey image, one for color image

  • the grey image algorithm is taken from: [nister2008linear] ; the paper claims to be faster than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop.

  • the color image algorithm is taken from: [forssen2007maximally] ; it should be much slower than grey image method ( 3~4 times )

  • (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py

Constructors and members

static create

Full constructor for %MSER detector

create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number, max_evolution: number, area_threshold: number, min_margin: number, edge_blur_size: number): MSER | null;
10 available overloads
create(): MSER | null;
create(delta: number): MSER | null;
create(delta: number, min_area: number): MSER | null;
create(delta: number, min_area: number, max_area: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number, max_evolution: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number, max_evolution: number, area_threshold: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number, max_evolution: number, area_threshold: number, min_margin: number): MSER | null;
create(delta: number, min_area: number, max_area: number, max_variation: number, min_diversity: number, max_evolution: number, area_threshold: number, min_margin: number, edge_blur_size: number): MSER | null;
delta

it compares (size_{i}-size_{i-delta})/size_{i-delta}

min_area

prune the area which smaller than minArea

max_area

prune the area which bigger than maxArea

max_variation

prune the area have similar size to its children

min_diversity

for color image, trace back to cut off mser with diversity less than min_diversity

max_evolution

for color image, the evolution steps

area_threshold

for color image, the area threshold to cause re-initialize

min_margin

for color image, ignore too small margin

edge_blur_size

for color image, the aperture size for edge blur

Returns

The MSER | null result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

detectRegions

Detect %MSER regions

detectRegions(image: Mat, msers: PointVectorVector, bboxes: RectVector): void;
image

input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3)

msers

Output destination, filled by the native operation. resulting list of point sets

bboxes

Output destination, filled by the native operation. resulting bounding boxes

setDelta

Set the delta used by this MSER object.

setDelta(delta: number): void;
delta

delta argument (number).

getDelta

Return the delta configured on this MSER object.

getDelta(): number;
Returns

The number result.

setMinArea

Set the min area used by this MSER object.

setMinArea(minArea: number): void;
minArea

min area argument (number).

getMinArea

Return the min area configured on this MSER object.

getMinArea(): number;
Returns

The number result.

setMaxArea

Set the max area used by this MSER object.

setMaxArea(maxArea: number): void;
maxArea

max area argument (number).

getMaxArea

Return the max area configured on this MSER object.

getMaxArea(): number;
Returns

The number result.

setMaxVariation

Set the max variation used by this MSER object.

setMaxVariation(maxVariation: number): void;
maxVariation

max variation argument (number).

getMaxVariation

Return the max variation configured on this MSER object.

getMaxVariation(): number;
Returns

The number result.

setMinDiversity

Set the min diversity used by this MSER object.

setMinDiversity(minDiversity: number): void;
minDiversity

min diversity argument (number).

getMinDiversity

Return the min diversity configured on this MSER object.

getMinDiversity(): number;
Returns

The number result.

setMaxEvolution

Set the max evolution used by this MSER object.

setMaxEvolution(maxEvolution: number): void;
maxEvolution

max evolution argument (number).

getMaxEvolution

Return the max evolution configured on this MSER object.

getMaxEvolution(): number;
Returns

The number result.

setAreaThreshold

Set the area threshold used by this MSER object.

setAreaThreshold(areaThreshold: number): void;
areaThreshold

area threshold argument (number).

getAreaThreshold

Return the area threshold configured on this MSER object.

getAreaThreshold(): number;
Returns

The number result.

setMinMargin

Set the min margin used by this MSER object.

setMinMargin(min_margin: number): void;
min_margin

min margin argument (number).

getMinMargin

Return the min margin configured on this MSER object.

getMinMargin(): number;
Returns

The number result.

setEdgeBlurSize

Set the edge blur size used by this MSER object.

setEdgeBlurSize(edge_blur_size: number): void;
edge_blur_size

edge blur size argument (number).

getEdgeBlurSize

Return the edge blur size configured on this MSER object.

getEdgeBlurSize(): number;
Returns

The number result.

setPass2Only

Set the pass2 only used by this MSER object.

setPass2Only(f: boolean): void;
f

f argument (boolean).

getPass2Only

Return the pass2 only configured on this MSER object.

getPass2Only(): boolean;
Returns

The boolean result.

getDefaultName

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

getDefaultName(): string;
Returns

The string result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.