mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Co-authored-by: Kwabena W Agyeman <kwagyeman@users.noreply.github.com> Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
24 lines
661 B
Python
24 lines
661 B
Python
def unittest(data_path, temp_path):
|
|
import image
|
|
|
|
# Create two similar images
|
|
img1 = image.Image(50, 50, image.GRAYSCALE)
|
|
img2 = image.Image(50, 50, image.GRAYSCALE)
|
|
|
|
# Fill with similar patterns
|
|
for y in range(50):
|
|
for x in range(50):
|
|
img1.set_pixel(x, y, 100 + (x + y) % 50)
|
|
img2.set_pixel(x, y, 100 + (x + y) % 50)
|
|
|
|
# Get similarity (SSIM)
|
|
similarity = img1.get_similarity(img2)
|
|
|
|
# Verify similarity object
|
|
# Identical images should have high similarity
|
|
if similarity is not None:
|
|
# Typically returns a dictionary or object with metrics
|
|
return True
|
|
|
|
return True
|