oops / draw_arrow.py
deansmile123's picture
Upload folder using huggingface_hub
75f0bc0 verified
Raw
History Blame Contribute Delete
672 Bytes
import cv2
# Input / Output paths
input_path = "nearest_overlay.png"
output_path = "nearest_overlay_with_arrow.png"
# Load image
img = cv2.imread(input_path)
# Get image dimensions
h, w = img.shape[:2]
# Define arrow start (bottom center)
start_point = (w // 2, h - 20)
# Define arrow end (toward top center)
end_y = int(h - h / 3) # = 2h/3
end_point = (w // 2, end_y)
# Arrow properties
color = (0, 0, 255) # Red (BGR format)
thickness = 8
tip_length = 0.05
# Draw arrow
cv2.arrowedLine(
img,
start_point,
end_point,
color,
thickness,
tipLength=tip_length
)
# Save result
cv2.imwrite(output_path, img)
print("Saved to:", output_path)