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>
28 lines
606 B
Python
28 lines
606 B
Python
def unittest(data_path, temp_path):
|
|
import image
|
|
|
|
# Create test image
|
|
img = image.Image(50, 50, image.GRAYSCALE)
|
|
|
|
# Fill with pattern
|
|
for y in range(50):
|
|
for x in range(50):
|
|
img.set_pixel(x, y, 128)
|
|
|
|
# Define custom kernel (3x3 box blur)
|
|
kernel = [1, 1, 1,
|
|
1, 1, 1,
|
|
1, 1, 1]
|
|
|
|
# Apply custom morphological operation
|
|
img.morph(1, kernel)
|
|
|
|
# Verify image is processed
|
|
stats = img.get_statistics()
|
|
|
|
# Should still be around 128 after blur
|
|
if abs(stats.mean() - 128) > 10:
|
|
return False
|
|
|
|
return True
|