This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

MSERRegions class

Object for storing MSER regions


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.


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.


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.

Input Arguments

expand all

Cell array of M-by-1 regions. Each region contains a P-by-2 array of [x y] coordinates of the detected MSER regions.


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


Number of stored regions

Default: 0


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


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.


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.


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


collapse all

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;

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);

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;


[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.

Extended Capabilities

Introduced in R2012a