I am trying to detect some markers on an image. However, with the markers being white, the SimpleBlobDetector of OpenCV gets confused by any glare.
For example, in the attached image, I can only detect 6 of the 7 markers (the 4 rings are ring lights and I do not want to detect them).
Could someone suggest a simple algorithm that could detect the 7th blob (on the le
import cv2
import numpy as np
# Set up the blob detector
params = cv2.SimpleBlobDetector_Params()
params.filterByColor = True
params.blobColor = 255
params.filterByArea = True
params.minArea = 50 # Adjust based on your ball size
params.maxArea = 400
params.filterByCircularity = True
params.minCircularity = 0.8 # Circular blobs
params.filterByConvexity = True
params.minConvexity = 0.9
detector = cv2.SimpleBlobDetector_create(params)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
keypoints = detector.detect(gray)
img_with_keypoints = cv2.drawKeypoints(frame,
keypoints,
np.array([]),
(0, 0, 255),
cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imshow('Detected Balls', img_with_keypoints)
cv2.waitKey(5)
cv2.destroyAllWindows()