| import numpy as np |
| from quadtree_engine import process_image |
|
|
| |
| arr = np.zeros((1000, 671, 3), dtype=np.uint8) |
| |
| arr[200:400, 200:471] = 255 |
|
|
| |
| res = process_image(arr, "water", 30) |
|
|
| print(f"Original shape: {arr.shape}") |
| print(f"Result shape: {res.shape}") |
|
|
| |
| 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!") |
| |
| |
| 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])}") |
|
|