plantation_project / postprocess.py
lokesh341's picture
Update postprocess.py
7902a75 verified
raw
history blame contribute delete
426 Bytes
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