I'm working with opencv on python.
I'm looking for an efficient way to use a mask to select all keypoints that fall inside it, after the keypoints were already detected.
TO BE CLEAR - I know that I can use a mask during the detection stage, what I need is to use another (different) mask after the keypoints were already detected (and this process is repeated with multiple sub-regions masks, so I can't combine 2 mask prior to detection).
import cv2
image = cv2.imread(some_image_file)
mask = cv2.imread(some_mask_file)
mask_2 = cv2.imread(some_additional_mask_file)
# Defining the detector:
detector = cv2.ORB_create(scoreType=cv2.ORB_FAST_SCORE)
# Detecting keypoints inside the initial mask's region:
kp, dsk = detector.detectAndCompute(image, mask)
# Using mask_2 to select a subset of the detected keypoints:
...


