我想从 python3.5 中的图像中提取 MSER 特征,但我找不到任何解决方案。我正在尝试以下代码:
import cv2
import sys
mser = cv2.MSER_create()
img = cv2.imread('signboard.jpg')
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))
cv2.imshow('img', vis)
if cv2.waitKey(0) == 9:
cv2.destroyAllWindows()
但在 mser.detectRegions 中出现错误。任何人都可以在 python3.5 中分享 MSER 的工作代码吗?