I'm using the simpleblobdetector from opencv with python to identify blobs in an image.
I'm able to get the simple blob detector to work and give me the locations of identified blobs. But can I also get the inertia/convexity/circularity/etc properties of identified blobs?
img = cv2.imread('image.png', cv2.IMREAD_GRAYSCALE)
# set up blob detector params
detector_params = cv2.SimpleBlobDetector_Params()
detector_params.filterByInertia = True
detector_params.minInertiaRatio = 0.001
detector_params.filterByArea = True
detector_params.maxArea = 10000000
detector_params.minArea = 1000
detector_params.filterByCircularity = True
detector_params.minCircularity = 0.0001
detector_params.filterByConvexity = True
detector_params.minConvexity = 0.01
detector = cv2.SimpleBlobDetector_create(detector_params)
# Detect blobs.
keypoints = detector.detect(img)
# print properties of identified blobs
for p in keypoints:
print(p.pt) # locations of blobs
# circularity???
# inertia???
# area???
# convexity???
# etc...
Thanks
p.ptyou can also get thep.size, not sure if that helps