I am trying to count the number of features detected by MSER feature detection algorithm in OPenCV Python. I have no idea how to do that. I would greatly appreciate it if someone helped me figure out the code. Below is the code I used for 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()
Result: