Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

For opencv 2.4:

import cv2
img = cv2.imread('bed.jpg', 0);
vis = img.copy()
mser = cv2.MSER()
regions = mser.detect(img, None)
hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions]
cv2.polylines(vis, hulls, 1, (0, 255, 0))
cv2.imshow('img', vis)
cv2.waitKey(0)
cv2.destroyAllWindows()