visualMovieAnalysis2.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:recognizeFitExercise 作者: tyiannak 项目源码 文件源码
def drawArrow(image, p, q, color, arrowMagnitude = 5, thickness=1, line_type=8, shift=0):
    # Draw the principle line
    cv2.line(image, tuple(p), tuple(q), color, thickness, line_type, shift);
    # compute the angle alpha
    angle = numpy.arctan2( p[1]-q[1], p[0]-q[0]);
    # compute the coordinates of the first segment
    p[0] =  int(q[0] +  arrowMagnitude * numpy.cos(angle + numpy.pi/4.0));
    p[1] =  int(q[1] +  arrowMagnitude * numpy.sin(angle + numpy.pi/4.0));
    # /Draw the first segment
    cv2.line(image, tuple(p), tuple(q), color, thickness, line_type, shift);
    # compute the coordinates of the second segment
    p[0] =  int(q[0] +  arrowMagnitude * numpy.cos(angle - numpy.pi/4.0));
    p[1] =  int(q[1] +  arrowMagnitude * numpy.sin(angle - numpy.pi/4.0));

    # Draw the second segment
    cv2.line(image, tuple(p), tuple(q), color, thickness, line_type, shift);
#    cv2.putText(image, str(int(180.0*angle/numpy.pi)), tuple(p), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, 255 )
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号