1

我正在尝试计算 OPenCV Python 中 MSER 特征检测算法检测到的特征数量。我不知道该怎么做。如果有人帮助我找出代码,我将不胜感激。下面是我用于 MSER 的代码。

import cv2 as cv
mser = cv.MSER_create()
img = cv.imread('image.jpg')
half = cv.resize(img, (1200, 800), fx=0.1, fy=0.1)
gray = cv.cvtColor(half, cv.COLOR_BGR2GRAY)
vis = half.copy()
regions, _ = mser.detectRegions(gray)
hulls = [cv.convexHull(p.reshape(-1, 1, 2)) for p in regions]
cv.polylines(vis, hulls, 1, (0, 255, 0))
cv.imshow('img', vis)
cv.waitKey(0)
cv.destroyAllWindows()

结果:

MSER 图像结果

4

0 回答 0