findCirclesGrid can't find sub-pattern with hollow insides
I'm trying to find a unique 2x2 hollow center sub-pattern inside a circle grid pattern. Using "detect", generates keypoints that indicate that the hollow circles are detected correctly, but the 2x2 pattern is not detected. Looking for a sub-pattern with full circles works.
The code could be boiled down to:
import numpy as np
import cv2
import matplotlib.pyplot as plt
orientation_grid_size = (2, 2)
params_orientaion = cv2.SimpleBlobDetector_Params()
params_orientaion.minArea = 200
params_orientaion.maxArea = 800
params_orientaion.minRepeatability = 1
params_orientaion.filterByColor = True
params_orientaion.blobColor = 255 # Detect only white centers
detector_orientation = cv2.SimpleBlobDetector_create(params_orientaion)
color_image = cv2.imread("1607961786.3423488.jpg")
color_image = cv2.cvtColor(color_image, cv2.COLOR_BGR2RGB)
status_orientation, grid_points_orientation = cv2.findCirclesGrid(color_image,
patternSize=orientation_grid_size,
flags=cv2.CALIB_CB_SYMMETRIC_GRID,
blobDetector=detector_orientation)
print(status_orientation)
keypoints = detector_orientation.detect(color_image)
im_with_keypoints = cv2.drawKeypoints(color_image, keypoints, np.array([]), (255, 0, 0),
cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
plt.imshow(im_with_keypoints)
plt.show(block=True)
The original image:
The image with the keypoints: