Capture Image From Camera
Using OpenCV, you can capture video from your computer's
webcam and use these videos for many purposes. OpenCV provides a very simple
interface for video capture process. It takes preparation to capture video. To
capture a video, you must create a VideoCapture object. Its argument may be the
device index.
capture = cv2.VideoCapture(0)
ret, frame = capture.read()
The codes are all as follows:
import cv2
capture = cv2.VideoCapture(0)
while(True):
# Capture the image
ret, frame = capture.read()
# Show the captured image
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('e'):
break
capture.release()
cv2.destroyAllWindows()
Comments
Post a Comment