示例#1
0
    link = row[3]  ## for the arrow-width and the alpha
    passer = player_objs_dict[row[1]]
    receiver = player_objs_dict[row[2]]

    alpha = link / 15
    if alpha > 1:
        alpha = 1

    if abs(receiver.x - passer.x) > abs(receiver.y - passer.y):

        if receiver.id > passer.id:
            ax.annotate("",
                        xy=(receiver.x, receiver.y + arrow_shift),
                        xytext=(passer.x, passer.y + arrow_shift),
                        arrowprops=dict(arrowstyle="-|>",
                                        color="0.25",
                                        shrinkA=shrink_val,
                                        shrinkB=shrink_val,
                                        lw=link * 0.12,
                                        alpha=alpha))

        elif passer.id > receiver.id:
            ax.annotate("",
                        xy=(receiver.x, receiver.y - arrow_shift),
                        xytext=(passer.x, passer.y - arrow_shift),
                        arrowprops=dict(arrowstyle="-|>",
                                        color="0.25",
                                        shrinkA=shrink_val,
                                        shrinkB=shrink_val,
                                        lw=link * 0.12,
                                        alpha=alpha))
示例#2
0
cap.set(0, 62200)

pitch = Pitch(['BL', 'I', 'I', 'I', 'TL', 'SL', '20M'])
frame_count = 0
# Read until video is completed
while (cap.isOpened()):
    # Capture frame-by-frame
    ret, frame = cap.read()

    if ret == True:
        if frame_count % 5 == 0:
            pitch.update(frame, True)
        else:
            pitch.update(frame)

        pitch.annotate(frame)

        cv2.imshow('Frame', frame)
        cv2.waitKey(0)
        # Press Q on keyboard to  exit
        if cv2.waitKey(25) & 0xFF == ord('q'):
            break

    # Break the loop
    else:
        break

    frame_count += 1

cv2.waitKey(0)
# When everything done, release the video capture object