Skip to content

Instantly share code, notes, and snippets.

@palaashatri
Last active August 12, 2020 06:03
Show Gist options
  • Save palaashatri/0017e6341045f9008371d1b95761c348 to your computer and use it in GitHub Desktop.
Save palaashatri/0017e6341045f9008371d1b95761c348 to your computer and use it in GitHub Desktop.
A simple application demonstrating video capture using Webcam on OpenCV
# A simple program that captures video from webcam and displays it on the screen
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret,frame = cap.read()
frame = cv2.resize(frame,(0,0),fx = 0.5, fy = 0.5)
cv2.imshow("Frame",frame)
ch = cv2.waitKey(1)
if ch & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment