First time here? Check out the FAQ!
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()