QuadTree / src /test_engine.py
daemon03's picture
Added code files
5c8cc9d verified
raw
history blame contribute delete
995 Bytes
import numpy as np
from quadtree_engine import process_image
# Create a mock "Mona Lisa" image: 1000x671
arr = np.zeros((1000, 671, 3), dtype=np.uint8)
# Draw a white rectangle to represent the face in the center
arr[200:400, 200:471] = 255
# Apply "water"
res = process_image(arr, "water", 30)
print(f"Original shape: {arr.shape}")
print(f"Result shape: {res.shape}")
# Check where the white pixels are in the result
white_pixels = np.where(res[:, :, 0] == 255)
if len(white_pixels[0]) > 0:
min_y, max_y = np.min(white_pixels[0]), np.max(white_pixels[0])
min_x, max_x = np.min(white_pixels[1]), np.max(white_pixels[1])
print(f"Face is at y: {min_y}-{max_y}, x: {min_x}-{max_x}")
else:
print("No white pixels found!")
# Let's also check if there are non-zero pixels outside the expected region
non_zero = np.where(res > 0)
if len(non_zero[0]) > 0:
print(f"All Non-zero y: {np.min(non_zero[0])}-{np.max(non_zero[0])}, x: {np.min(non_zero[1])}-{np.max(non_zero[1])}")