Open In App

Python OpenCV | cv2.arrowedLine() method

Last Updated : 19 Dec, 2025
Comments
Improve
Suggest changes
1 Likes
Like
Report

The cv2.arrowedLine() method in OpenCV is used to draw an arrow between two points on an image. It lets you choose the arrow’s start point, end point, color, thickness, and arrow-tip size making it useful for annotations, directions, object tracking, and visual marking in images.

Note: For this article we will use a sample image "logo.png", to download it click here.

Example: This example loads an image and draws a simple green arrow using minimal parameters.

Python
import cv2

img = cv2.imread("logo.png")

start = (50, 50)
end = (200, 200)

img = cv2.arrowedLine(img, start, end, (0, 255, 0), 3)

cv2.imshow("Arrow", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output
Output

Explanation:

  • cv2.arrowedLine(img, start, end, ...): draws the arrow
  • start: starting point of arrow
  • end: where arrow points
  • (0, 255, 0): green color in BGR
  • 3: arrow thickness

Syntax

cv2.arrowedLine(image, start_point, end_point, color, thickness, line_type, shift, tipLength)

Parameters:

  • image: Image on which arrow is drawn.
  • start_point: Starting coordinate (x, y).
  • end_point: Ending coordinate (x, y).
  • color: Arrow color in BGR.
  • thickness: Line thickness in pixels.
  • line_type: Type of line (optional).
  • shift: Fractional bits in coordinates (optional).
  • tipLength: Size of arrow tip relative to total arrow length.

Examples of cv2.arrowedLine()

Example 1: This example draws a thick green arrow in a diagonal direction using default arrow-tip size.

Python
import cv2

img = cv2.imread("logo.png")

start = (0, 0)
end = (200, 200)

img = cv2.arrowedLine(img, start, end, (0, 255, 0), 8)

cv2.imshow("Example 1", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output1
Green diagonal arrow

Explanation: arrowedLine(img, start, end, (0, 255, 0), 8) draws a thick green arrow from top-left to bottom-right.

Example 2: This example draws a red arrow with a larger arrow-tip size (0.5) for more emphasis.

Python
import cv2

img = cv2.imread("logo.png")

start = (220, 20)
end = (50, 120)

img = cv2.arrowedLine(img, start, end, (0, 0, 255), 6, tipLength=0.5)

cv2.imshow("Example 2", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output2
Red arrow with a large arrowhead

Explanation:

  • tipLength=0.5 makes the arrowhead larger than default
  • (0, 0, 255) red color

Example 3: This example draws a thin blue arrow with a custom line type for smoother rendering.

Python
import cv2

img = cv2.imread("logo.png")

start = (100, 150)
end = (300, 80)

img = cv2.arrowedLine(img, start, end, (255, 0, 0), 2, line_type=cv2.LINE_AA)

cv2.imshow("Example 3", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output3
Blue smooth arrow using anti-aliased line

Explanation:

  • line_type=cv2.LINE_AA creates smoother arrow edges
  • (255, 0, 0) blue color

Explore