forked from ProfessorKazarinoff/extensometer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
video_grab.py
51 lines (46 loc) · 1.14 KB
/
video_grab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import numpy as np
import cv2
import time
from imutils.video import VideoStream
import imutils
cap = cv2.VideoCapture(0)
cap.set(3,160)
cap.set(4,120)
#vs = VideoStream(0,False,(320,240),15)
while True:
ret, frame = cap.read()
#frame = imutils.resize(frame, width=400)
#gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',frame)
key = cv2.waitKey(1) & 0xFF
# if the `q` key was pressed, break from the loop
if key == ord("q"):
break
#
# if cap.isOpened():
# print('Capture is open')
# else:
# print('Capture is closed')
# print('Opening Capture')
# try:
# cap.open()
# except:
# print('Tried to open the capture, but could not')
#
# check, read = cap.read()
# print(check)
# print(read)
# while(True):
# # Capture frame-by-frame
# ret, frame = cap.read()
#
# # Our operations on the frame come here
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
#
# # Display the resulting frame
# cv2.imshow('frame',gray)
# if cv2.waitKey(1) & 0xFF == ord('q'):
# break
# When everything done, release the capture
cap.release()
#cv2.destroyAllWindows()