Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SimpleBlobDetector_Params() doesn't detect the blobs on the edges of the image

So I have this image of blobs below:

image description

When I ran the code below, some of the blobs on the edges of the image weren't on detected as seen on the next image.

image description

Can anyone help me with detecting the others? Thanks

params = cv2.SimpleBlobDetector_Params()
params.minDistBetweenBlobs = 10
params.filterByColor = True
params.maxArea = 10000
params.minThreshold = 10
params.maxThreshold = 200
params.filterByArea = True
params.minArea = 50
params.filterByCircularity = True
params.minCircularity = 0
params.filterByConvexity = True
params.minConvexity = 0
params.filterByInertia = True
params.minInertiaRatio = 0.1
detector = cv2.SimpleBlobDetector(params)
keypoints = detector.detect(res)
im_with_keypoints = cv2.drawKeypoints(img, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
res = cv2.drawKeypoints(res, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
print("LENGTH: %d" %len(keypoints))
print(keypoints)
i=0
for kp in keypoints:
    print("(%f,%f)"%(kp.pt[0],kp.pt[1]))
    i+=1
    cv2.rectangle(res,(int(kp.pt[0]),int(kp.pt[1])),(int(kp.pt[0])+1,int(kp.pt[1])+1),(0,255,0),3)
print("LEN: %d" %i)
cv2.imshow("Keypoints", im_with_keypoints)
cv2.imshow("RES", res)
cv2.waitKey(0)