imgProcess_tool.py 文件源码

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

项目:Farmbot_GeneralAP 作者: SpongeYao 项目源码 文件源码
def draw_XYcoord(arg_frame, arg_pt, arg_dirList):
    arg_x_axis_reverse= arg_dirList[0]
    arg_y_axis_reverse= arg_dirList[1]
    arg_xy_axis_swap= arg_dirList[2]

    frame= arg_frame.copy()
    hor_word = "X"
    ver_word = "Y"
    hor_color = (0, 255, 0)
    ver_color = (0, 0, 255)
    #hor_start, hor_stop = (60, 50), (150, 50)
    #ver_start, ver_stop = (50, 60), (50, 150)
    hor_start, hor_stop = (arg_pt[0]+10, arg_pt[1]), (arg_pt[0]+ 90, arg_pt[1]+ 0)
    ver_start, ver_stop = (arg_pt[0], arg_pt[1]+10), (arg_pt[0]+ 0, arg_pt[1]+ 90) 

    #print arg_xy_axis_swap
    if arg_x_axis_reverse:
        hor_start, hor_stop = hor_stop, hor_start
    if arg_y_axis_reverse:
        ver_start, ver_stop = ver_stop, ver_start
    if arg_xy_axis_swap:
        #(hor_word, hor_color, hor_start, hor_stop, ver_word, ver_color, ver_start, ver_stop) =\
        #(ver_word, ver_color, ver_start, ver_stop, hor_word, hor_color, hor_start, hor_stop)
        hor_word, hor_color, ver_word, ver_color =\
        ver_word, ver_color, hor_word, hor_color

    #print hor_word, hor_color, ver_word, ver_color
    cv2.arrowedLine(frame, hor_start, hor_stop, hor_color, 5, 8, 0, 0.2)
    cv2.arrowedLine(frame, ver_start, ver_stop, ver_color, 5, 8, 0, 0.2)
    cv2.putText(frame, hor_word, (arg_pt[0]+ 30, arg_pt[1]- 10) , cv2.FONT_HERSHEY_DUPLEX, 0.7, hor_color, 2)
    cv2.putText(frame, ver_word, (arg_pt[0]- 20, arg_pt[1]+ 50) , cv2.FONT_HERSHEY_DUPLEX, 0.7, ver_color, 2)
    return frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号