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.





No comments:

Post a Comment

Please ask if anything is not clear enough..........