Ask Your Question
1

HOW TO: mser constructor with algorithm parameters (python)

asked 2013-12-28 05:06:07 -0600

Koen Wildemeersch gravatar image

Hi all,

I've noticed that using C++ it is possible to set the algorithm parameters when constructing the object. (see: http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html?highlight=mser#MSER : public FeatureDetector)

I do not succeed to do the same in python (see code below). The object is constructed without errors, but I can't see the properties, nor modify them or set them manually. Any ideas? Btw, I'm using this mser method because it returns me the contours and not only the key points.

_delta = 10 
_min_area = 25 
_max_area = 2000
_max_variation = 10.0 
_min_diversity = 10.0
_max_evolution = 10 
_area_threshold = 12.0
_min_margin = 2.9 
_edge_blur_size = 3    

mser2 = cv2.MSER(_delta,_min_area,_max_area,
      _max_variation, _min_diversity,
      _max_evolution, _area_threshold,
      _min_margin, _edge_blur_size )

Best of wishes for 2014!

Kind regards, Koen

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-15 02:01:10 -0600

navderm gravatar image
mser = cv2.MSER(1, 0, 94400, 0.05, 0.02, 200, 1.01, 0.003, 5)
regions = mser.detect(gray, None)
hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions]
cv2.polylines(vis, hulls, 1, (0, 255, 0))
cv2.putText(vis, str(change), (20, 20), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 0, 0))

This worked perfectly fine for me.

edit flag offensive delete link more

Comments

note: this is using opencv2.4

berak gravatar imageberak ( 2016-03-23 04:45:03 -0600 )edit

Question Tools

Stats

Asked: 2013-12-28 05:06:07 -0600

Seen: 4,131 times

Last updated: Oct 15 '14