tag:blogger.com,1999:blog-1179878609492304959.post886085066989755549..comments2022-04-08T01:05:20.115-07:00Comments on HAZAR MLIKI : Draw an Arrow with OpenCV (and python version too)Hazar MLIKIhttp://www.blogger.com/profile/07598248319418762093noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-1179878609492304959.post-58068260740248355032017-03-18T00:10:09.678-07:002017-03-18T00:10:09.678-07:00Thank you so much for this code :)Thank you so much for this code :)Anonymoushttps://www.blogger.com/profile/16330943836779004417noreply@blogger.comtag:blogger.com,1999:blog-1179878609492304959.post-70924997321346312062015-07-25T01:41:57.038-07:002015-07-25T01:41:57.038-07:00Thank you both, you have saved me time.
Please giv...Thank you both, you have saved me time.<br />Please give me your bitcoin address, I would like you to have a beer on me.Anonymoushttps://www.blogger.com/profile/07476856851799866519noreply@blogger.comtag:blogger.com,1999:blog-1179878609492304959.post-6231576525713778692013-10-28T08:04:16.529-07:002013-10-28T08:04:16.529-07:00Thanks a lot !Thanks a lot !Hazar MLIKIhttps://www.blogger.com/profile/07598248319418762093noreply@blogger.comtag:blogger.com,1999:blog-1179878609492304959.post-90603125956679862682013-10-27T09:22:43.112-07:002013-10-27T09:22:43.112-07:00Thank you for posting your function it saved me a ...Thank you for posting your function it saved me a lot of time when I needed to do the same thing in python. Here is my python version in case anybody reading your page can make use of it.<br /><br />def draw_arrow(image, p, q, color, arrow_magnitude=9, thickness=1, line_type=8, shift=0):<br /> # adapted from http://mlikihazar.blogspot.com.au/2013/02/draw-arrow-opencv.html<br /> <br /> # draw arrow tail<br /> cv2.line(image, p, q, color, thickness, line_type, shift)<br /> # calc angle of the arrow <br /> angle = np.arctan2(p[1]-q[1], p[0]-q[0])<br /> # starting point of first line of arrow head <br /> p = (int(q[0] + arrow_magnitude * np.cos(angle + np.pi/4)),<br /> int(q[1] + arrow_magnitude * np.sin(angle + np.pi/4)))<br /> # draw first half of arrow head<br /> cv2.line(image, p, q, color, thickness, line_type, shift)<br /> # starting point of second line of arrow head <br /> p = (int(q[0] + arrow_magnitude * np.cos(angle - np.pi/4)),<br /> int(q[1] + arrow_magnitude * np.sin(angle - np.pi/4)))<br /> # draw second half of arrow head<br /> cv2.line(image, p, q, color, thickness, line_type, shift)Unknownhttps://www.blogger.com/profile/01396532458776300192noreply@blogger.com