Often, we have to capture live stream with camera. OpenCV provides a very simple interface to this. Le us capture a video from the camera (I am using the in-built webcam of my laptop), display it.
To capture a video, we need to create a VideoCapture object. Its argument can be either the device index or the name of a video file. Device index is just the number to specify which camera. Normally one camera will be connected (as in my case). So we simply pass 0 (or -1). We can select the second camera by passing 1 and so on. After that, we can capture frame-by-frame. But at the end, don't forget to release the capture.
Comments