Documentation Center

  • Trial Software
  • Product Updates

MSERRegions class

Object for storing MSER regions

Description

This object describes MSER regions and corresponding ellipses that have the same second moments as the regions. It passes data between the detectMSERFeatures and extractFeatures functions. The object can also be used to manipulate and plot the data returned by these functions.

Tips

Although MSERRegions may hold many regions, it is a scalar object. Therefore, NUMEL(MSERRegions) always returns 1. This value may differ from LENGTH(MSERRegions), which returns the true number of regions held by the object.

Construction

regions = MSERRegions(pixellist) constructs an MSER regions object, regions, from an M-by-1 cell array of regions,pixellist. Each cell contains a P-by-2 array of [x y] coordinates for the detected MSER regions, where P varies based on the number of pixels in a region.

Code Generation Support
Compile-time constant inputs: No restrictions.
Supports MATLAB Function block: Yes
For code generation, you must specify both the pixellist cell array and the length of each array, as the second input. The object outputs, regions.PixelList as an array. The region sizes are defined in regions.Lengths.
Generated code for this function uses a precompiled platform-specific shared library.
Code Generation Support, Usage Notes, and Limitations

Input Arguments

pixellist

M-by-2 cell array of [x y] coordinates of the detected MSER regions.

Properties

The following properties are read-only and are calculated once the input pixel list is specified.

Count

Number of stored regions

Default: 0

Location

An M-by-2 array of [x y] centroid coordinates of ellipses that have the same second moments as the MSER regions.

Axes

A two-element vector, [majorAxis minorAxis]. This vector specifies the major and minor axis of the ellipse that have the same second moments as the MSER regions.

Orientation

A value in the range from -pi/2 to +pi/2 radians. This value represents the orientation of the ellipse as measured from the X-axis to the major axis of the ellipse. You can use this property for visualization purposes.

Methods

isemptyReturns true for empty object
lengthNumber of stored points
plotPlot MSER regions
sizeSize of the MSERRegions object

Examples

expand all

Detect MSER Features in an Image

Load an image.

I = imread('cameraman.tif');

Detect and store regions.

regions = detectMSERFeatures(I); 

Display the centroids and axes of detected regions.

imshow(I); hold on;
plot(regions);

Display MSER Feature Regions from the MSERRegions Object

Detect and display the first 10 regions contained in the MSERRegions object

Detect MSER features.

  I = imread('cameraman.tif');
  regions = detectMSERFeatures(I);

Display the first 10 regions in the MSERRegions object.

imshow(I); hold on;
plot(regions(1:10),'showPixelList', true);

Combine MSER Region Detector with SURF Descriptors

Extract and display SURF descriptors at locations identified by MSER detector.

Read image.

I = imread('cameraman.tif');

Detect MSER features.

regionsObj = detectMSERFeatures(I);

Extract and display SURF descriptors.

[features, validPtsObj] = extractFeatures(I, regionsObj);
imshow(I); hold on;
plot(validPtsObj,'showOrientation',true);

References

[1] Nister, D., and H. Stewenius, "Linear Time Maximally Stable Extremal Regions", Lecture Notes in Computer Science. 10th European Conference on Computer Vision, Marseille, France: 2008, no. 5303, pp. 183–196.

[2] Matas, J., O. Chum, M. Urba, and T. Pajdla. "Robust wide baseline stereo from maximally stable extremal regions. "Proceedings of British Machine Vision Conference, pages 384-396, 2002.

See Also

| | | | |

Was this topic helpful?