Extract MSER detected areas (Python, OpenCV)
问题 I can't extract the detected regions by MSER in this image: What I want to do is to save the green bounded areas. My actual code is this: import cv2 import numpy as np mser = cv2.MSER_create() img = cv2.imread('C:\\Users\\Link\\img.tif') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) vis = img.copy() regions, _ = mser.detectRegions(gray) hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions] cv2.polylines(vis, hulls, 1, (0, 255, 0)) mask = np.zeros((img.shape[0], img.shape[1], 1), dtype