Created
April 24, 2021 01:50
-
-
Save guinslym/c5cb9551a21a34b1155f8f8d8a71f16f to your computer and use it in GitHub Desktop.
image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
import imutils | |
vid = cv2.VideoCapture(0) | |
if not vid.isOpened(): | |
print("Error: Could not open video.") | |
exit() | |
cv2.namedWindow("Image", cv2.WND_PROP_FULLSCREEN) | |
cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN) | |
if vid.isOpened(): | |
print ("Connected....") | |
while True: | |
ret, frame = vid.read() | |
if ret: | |
frame = cv2.resize(frame, (0,0), fx=2, fy=2) | |
#frame = imutils.resize(frame, width=1200, height=800) | |
cv2.imshow("Image", frame) | |
else: | |
print ("Error aqcuiring the frame") | |
break | |
ch = cv2.waitKey(1) | |
if ch & 0xFF == ord('q'): | |
break | |
else: | |
print ("Not Connected....") | |
vid.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment