Spaces:
Runtime error
Runtime error
| import cv2 | |
| def mark_trees(image, trees): | |
| """Draw bounding boxes for trees on the image.""" | |
| if trees.size > 0: # Only draw if trees are detected | |
| for tree in trees: | |
| x1, y1, x2, y2 = map(int, tree[:4]) | |
| cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2) # Green box | |
| cv2.putText(image, "Tree", (x1, y1-10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2) | |
| return image |