import cv2 import numpy as np def crop_stream_segment(): # Load the processed stream segment img = cv2.imread("assets/environment/potok_segment.png", cv2.IMREAD_UNCHANGED) if img is None: print("Error: Could not load image.") return h, w = img.shape[:2] # The image is an isometric block. The bottom part is the "front wall". # To make it look "sunken" or flat, we should remove the bottom front dirt wall. # Let's interactively guess: removing the bottom 1/3 might work. # Crop top 75% (Remove bottom 25%) # Adjust this factor based on visual inspection of "cube" height vs "face" height # Ideally, we keep the top surface. crop_height = int(h * 0.70) # Crop cropped = img[0:crop_height, 0:w] # Save cv2.imwrite("assets/environment/potok_segment.png", cropped) print(f"Cropped image from {h} to {crop_height} height.") crop_stream_segment()