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
722 B
Python
24 lines
722 B
Python
def unittest(data_path, temp_path):
|
|
import image
|
|
|
|
# Create test image with regions
|
|
img = image.Image(64, 64, image.RGB565)
|
|
|
|
# Create distinct regions
|
|
for y in range(64):
|
|
for x in range(64):
|
|
if x < 32 and y < 32:
|
|
color = 0xF800 # Red
|
|
elif x >= 32 and y < 32:
|
|
color = 0x07E0 # Green
|
|
elif x < 32 and y >= 32:
|
|
color = 0x001F # Blue
|
|
else:
|
|
color = 0xFFFF # White
|
|
img.set_pixel(x, y, color)
|
|
|
|
# Perform selective search segmentation
|
|
regions = img.selective_search(threshold=200, min_size=10)
|
|
|
|
return regions[0] == (0, 0, 63, 31) and regions[1] == (0, 0, 63, 63)
|