Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw two-sided arrow on image using opencv python

I want to draw two sided arrow between two points using opencv. I have got one function for single arrow plot which is follows

import cv2

img = cv2.imread('image.jpg', cv2.IMREAD_COLOR)
pt1 = (x1, y1)
pt2 = (x2, y2)
cv2.arrowedLine(img_, pt1, pt2, (0,0,255), 5)
cv2.imshow('Image with arrow', img)
cv2.waitKey(0)

But is there any method for plotting two sided arrows between two points? I have read the documentation but did not find any. Please guide. Thanks.

like image 940
muazfaiz Avatar asked Feb 20 '17 17:02

muazfaiz


1 Answers

Well This may not be the best way, but with minimal effort I would use the same cv2.arrowedLine method twice with the points order reversed as :

cv2.arrowedLine(img_, pt1, pt2, (0,0,255), 5)
cv2.arrowedLine(img_, pt2, pt1, (0,0,255), 5)
like image 61
ZdaR Avatar answered Oct 14 '22 15:10

ZdaR