INNER CODE UNIT · Python

getVideoStream

chonyy/AI-basketball-analysis · src/app_helper.py:18

def getVideoStream(video_path):
    datum, opWrapper = openpose_init()
    detection_graph, image_tensor, boxes, scores, classes, num_detections = tensorflow_init()

    cap = cv2.VideoCapture(video_path)
    width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
    height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
    fps = cap.get(cv2.CAP_PROP_FPS)
    trace = np.full((int(height), int(width), 3), 255, np.uint8)

    fig = plt.figure()
    #objects to store detection status
    previous = {
    'ball': np.array([0, 0]),  # x, y
    'hoop': np.array([0, 0, 0, 0]),  # xmin, ymax, xmax, ymin
        'hoop_height': 0
    }
    during_shooting = {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…