Ask Your Question

MSER detection error: detected region not extremal

asked 2013-09-18 10:18:22 -0500

updated 2013-09-18 10:20:09 -0500

berak gravatar image

I am writing my own implementation of MSER (Maximally Stable Extremal Regions) detectors and was using OpenCV implementation to check the correctness of my results. When comparing the detections, I came across a region detected by OpenCV implementation that is not extremal.

From the original paper, the definition of positive (maximum intensity) extremal region is that all the pixels belonging to the region have the intensity strictly higher than the border pixels.

While examining a region detected by OpenCV implementation but not my own detector, I found a region pixel with same intensity as one of the border pixels.

I was using a grayscale Lena Image. OpenCV version used is 2.3.1, but I've skimmed the code of the current version and there do not seem to be any major differences. The OpenCV parameters used are:

  • [minArea, maxArea] = [60, 20000]
  • delta = 30 (at this level, there is only 6 OpenCV detections so it is easy to examine them)
  • maxDiversity = 0.25
  • minVariation = 0.2

I've written a simple test-routine that checks the values of all in-region pixels against all border pixels, and four of them are not extremal (the highest-value border intensity pixel is the same as lowest-value region pixel or vice-versa). Here are the sizes (in pixels) of those regions, and the range of pixel intensities for border pixels and region pixels:

  • size: 14659, inside: [24, 82], border: [82, 187]
  • size: 11296, inside: [21, 93], border: [93, 218]
  • size: 6187, inside: [125, 215], border: [82, 125]
  • size: 15785, inside: [76, 212], border: [30, 76]

Note that I adopted the variation formula in my implementation to the one used by OpenCV (||R_{i}-R_{i-delta}||/||R_{i-delta}|| instead of||R_{i+delta}-R_{i-delta}||/||R_{i}||) and I am getting very similar regions with my own implementation, although not the same (all of my regions are extremal).

So, bottom line, even if I am getting very similar results with both OpenCV implementation and my own, the regions detected by OpenCV implementation are not extremal and I believe this is an error.

edit retag flag offensive close merge delete


time for an issue, imho.

berak gravatar imageberak ( 2013-09-18 10:22:10 -0500 )edit

@berak I just reported it here. Thanks

penelope gravatar imagepenelope ( 2013-09-19 06:44:38 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-17 21:36:15 -0500

In my understanding MSER.cpp detects both 'black on white' and 'white on black' MSERs. See routine extractMSER_8UC1() which calls both versions and can be modified with a bespoke compilation to detect only one type of MSER.

In my opinion, the main calling MSER procedure should be controlled by a flag to detect 'black on white', 'white on black' OR both types of MSERs.

Either way the documentation should be updated to make clear the performance and how it can be altered if a user requires it.

edit flag offensive delete link more


I check mser.cpp in 3.0 version and it is different from the one in 2.4, but the functions are quite similar (like just name change). Can we verify that it is fixed now?

cuongvt101 gravatar imagecuongvt101 ( 2016-09-16 14:47:45 -0500 )edit

Question Tools

1 follower


Asked: 2013-09-18 10:18:22 -0500

Seen: 928 times

Last updated: Oct 17 '13