You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am wondering if it's possible to carry out FLANN or BRUTEFORCE using cv2.cuda.
My research indicates it's possible but attempting to alter matching.py with the following fails:
def match_brute_force(
f1: np.ndarray,
f2: np.ndarray,
config: Dict[str, Any],
maskij: Optional[np.ndarray] = None,
) -> List[Tuple[int, int]]:
"""
Brute force matching and Lowe's ratio filtering using CUDA and Stream.
Args:
f1: feature descriptors of the first image
f2: feature descriptors of the second image
config: config parameters
maskij: optional boolean mask of len(i descriptors) x len(j descriptors)
"""
assert f1.dtype.type == f2.dtype.type
if f1.dtype.type == np.uint8:
matcher_type = "BruteForce-Hamming"
else:
matcher_type = "BruteForce"
matcher = cv2.cuda.DescriptorMatcher.createBFMatcher
matcher.add([f2])
stream = cv2.cuda_Stream()
matches = matcher.knnMatchConvert(f1, k=2, stream=stream)
stream.waitForCompletion()
ratio = config["lowes_ratio"]
good_matches = []
for match in matches:
if match and len(match) == 2:
m, n = match
if m.distance < ratio * n.distance:
good_matches.append(m)
return _convert_matches_to_vector(good_matches)
with the error: AttributeError: module 'cv2.cuda' has no attribute 'DescriptorMatcher.createBFMatcher'
[static Ptrcuda::DescriptorMatcher cv::cuda::DescriptorMatcher::createBFMatcher | (| int | normType = cv::NORM_L2 | )]
For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets.
Parameters
normType | One of NORM_L1, NORM_L2, NORM_HAMMING. L1 and L2 norms are preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and BRIEF).
Any ideas?
The text was updated successfully, but these errors were encountered:
I am wondering if it's possible to carry out FLANN or BRUTEFORCE using cv2.cuda.
My research indicates it's possible but attempting to alter matching.py with the following fails:
with the error:
AttributeError: module 'cv2.cuda' has no attribute 'DescriptorMatcher.createBFMatcher'
OpenCV.org: CUDA Descriptor Matcher
says that:
Any ideas?
The text was updated successfully, but these errors were encountered: