import cv2
import numpy as np

drawing = False
point1 = ()
point2 = ()

def mouse_drawing(event, x, y, flags, params):
    global point1, point2, drawing
    if event == cv2.EVENT_LBUTTONDOWN:
        if drawing is False:
            drawing = True
            point1 = (x, y)
        else:
            drawing = False

    elif event == cv2.EVENT_MOUSEMOVE:
        if drawing is True:
            point2 = (x, y)

cap = cv2.VideoCapture("/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_source/recs/a_history_of_the_domino_problem_final_documentation_hq.mp4")

# Exit if video not opened.
if not cap.isOpened():
    print("Could not open video")
    sys.exit()

# Read first frame.
cap.set(cv2.CAP_PROP_POS_FRAMES, 5000)
ok, initFrame = cap.read()
if not ok:
    print('Cannot read video file')
    sys.exit()

cv2.namedWindow("Frame")
#cv2.setMouseCallback("Frame", mouse_drawing)

while cap.isOpened():
    ok, frame = cap.read()

    if ok == True:

        #if point1 and point2:
        #    cv2.rectangle(frame, point1, point2, (0, 255, 0))

        cv2.imshow("Frame", frame)

    else:
        break


cap.release()
cv2.destroyAllWindows()