Skip to content
Snippets Groups Projects
Commit f69019c2 authored by Formanek Balázs István's avatar Formanek Balázs István
Browse files

real time video

parent 36afc2c1
Branches
No related tags found
No related merge requests found
import cv2
import random
def main():
cap = cv2.VideoCapture(0)
if ~cap.isOpened():
print("Warning: cannot reach camera")
while cap.isOpened():
ret, frame = cap.read()
if not ret:
print("Warning: cannot read camera input")
break
frame = cv2.flip(frame, 1)
frameRGB = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
cv2.imshow('Frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
print("Quit camera")
break
cap.release()
cv2.destroyAllWindows()
print("Program closed")
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment