Main Content


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.




regions = MSERRegions(pixellist) constructs an MSER regions object, regions regions from the pixel list,pixellist.

Input Arguments

expand all

Point coordinates for detected MSER regions, specified as a M-by-1 cell array. 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.


expand all

This property is read-only.

Locations of ellipses, stored as an M-by-2 array of [x y] coordinates. The ellipses that have the same second moments as the MSER regions.

This property is read-only.

Major and minor axis, stored as 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.

This property is read-only.

Ellipse orientation, stored as 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.

Number of stored regions, specified as an integer.

Object Functions

isemptyDetermine if points object is empty
lengthNumber of stored points
sizeReturn size of points object
plotPlot MSER regions


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;


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.


[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

Version History

Introduced in R2012a