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>
20 lines
503 B
Python
20 lines
503 B
Python
def unittest(data_path, temp_path):
|
|
import image
|
|
|
|
# Create non-square test image
|
|
img = image.Image(60, 40, image.GRAYSCALE)
|
|
|
|
# Fill with pattern
|
|
for y in range(40):
|
|
for x in range(60):
|
|
img.set_pixel(x, y, (x + y) % 256)
|
|
|
|
# Transpose image (swap width and height)
|
|
img_t = img.copy(x_scale=1.0, y_scale=1.0, hint=image.TRANSPOSE)
|
|
|
|
# Verify dimensions are swapped
|
|
if img_t.width() != 40 or img_t.height() != 60:
|
|
return False
|
|
|
|
return True
|