openmv/scripts/unittest/tests/keypoints_find_match.py
iabdalkader 4b1837f72e scripts: Update unit tests.
Co-authored-by: Kwabena W Agyeman <kwagyeman@users.noreply.github.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-10-18 17:14:36 +02:00

23 lines
663 B
Python

def unittest(data_path, temp_path):
import image
# Load image and find keypoints
img = image.Image(data_path + "/graffiti.pgm", copy_to_fb=True)
kpts1 = img.find_keypoints(max_keypoints=50, threshold=20, normalized=False)
# Load descriptor
kpts2 = image.load_descriptor(data_path + "/graffiti.orb")
# Match keypoints
match = image.match_descriptor(kpts1, kpts2, threshold=85)
return (
match.cx() == 143
and match.cy() == 108
and match.x() == 36
and match.y() == 34
and match.w() == 251
and match.h() == 141
and match.count() == 50
and match.theta() == 0
)