openmv/scripts/unittest/tests/haarcascade.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

15 lines
453 B
Python

def unittest(data_path, temp_path):
import image
# Load Haar Cascade
cascade = image.HaarCascade(data_path + "/frontalface.cascade")
# Load image and find keypoints
img = image.Image(data_path + "/dennis.pgm", copy_to_fb=True)
# Find objects
objects = img.find_features(cascade, threshold=0.75, scale_factor=1.25)
return (
objects and objects[0] == (189, 53, 88, 88) and objects[1] == (12, 11, 107, 107)
)