Python Source Code :
# Python Program to Capture Video on Desktop
# import opencv (cv2) library
import cv2
# define a video capture object
videobj = cv2.VideoCapture(0)
while(True): # Frames are captured until you press 'q'
# Capture the video frame by frame
ret, frame = videobj.read()
# Display the resulting frame on Desktop window
cv2.imshow('frame', frame)
# when the 'q' button is loop breaks
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
videobj.release()
# Destroy all the windows
cv2.destroyAllWindows()
Output :
