Showing posts with label MSER. Show all posts
Showing posts with label MSER. Show all posts

Monday, July 1, 2013

Extract MSER and Fit ellipses using OpenCV (MexOpenCV)

For this small tutorial make sure you have MexOpenCV installed in your system.

We will first extract maximally stable extremal regions (MSER). Second, for each MSER we will fit an ellipse. Finally, we will draw those ellipses on the image.




All MSERs are fitted to ellipses!
Fitted Ellipses are drawn on the source image 
To view a particular ellipse captured from the image after positioning in a up right situation


Rotated according to angle of rectangle covering the ellipse. Please see the above code

After rotation, image patch is extracted using  getRectSubPix


now, resize the above patch into a fixed size patch such as 30x30 square



resized to 30x30 square using cubic interpolation

cv.fitEllipse calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. It returns the rotated rectangle in which the ellipse is inscribed. The algorithm [Fitzgibbon95] is used.





Wednesday, September 12, 2012

Why extremal regions are interesting?

In the article of Maximally Stable Extremal Region (MSER) [1], why so called "extremal region" are interesting?
----------------------------------------------------------------------------------------------------------
Extremal regions are interesting because the set of extremal regions are closed [2] under
  1. Continuous (and thus projective )  transformation of image coordinates
  2. Monotonic transformation of image intensities
But what does it mean? What does a close set mean in this case? 
Well, it means any pixel outside the extremal region may not be described by projective transformation (due to viewpoint change). However, pixels inside the extremal regions can be described by projective tranformation. Therefore, Since these extremal regions are affinely covariant, they are more likely to be matched in other views. The whole idea is to find some image regions which are robust to affine covariant transformation. And these extremal regions does that job!



[1] Matas, J.; Chum, O.; Urban, M. & Pajdla, T. Robust wide-baseline stereo from maximally stable extremal regions Image and Vision Computing, Elsevier, 2004, 22, 761-767


[2] Definition of closed set from wiki is "A closed set contains its own boundary. In other words, if you are "outside" a closed set, you may move a small amount in any direction and still stay outside the set."