Python provides various libraries for image and video processing. One of them is OpenCV. OpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can capture a video from the camera. It lets you create a video capture object which is helpful to capture videos through webcam and then you may perform desired operations on that video.
Steps to capture a video:
cv2.VideoCapture() to get a video capture object for the camera.
- Set up an infinite while loop and use the
read()method to read the frames using the above created object.
cv2.imshow()method to show the frames in the video.
- Breaks the loop when the user clicks a specific key.
Below is the implementation.
- Set Countdown timer to Capture Image using Python-OpenCV
- Check if the camera is opened or not using OpenCV-Python
- Opening multiple color windows to capture using OpenCV in Python
- Python | Play a video using OpenCV
- Python - Process images of a video using OpenCV
- Python OpenCv: Write text on video
- Python | Play a video in reverse mode using OpenCV
- Python | Create video using multiple images using OpenCV
- OpenCV Python program for Vehicle detection in a Video frame
- OpenCV | Loading Video
- Saving a Video using OpenCV
- OpenCV C++ Program to blur a Video
- OpenCV C++ Program to play a video
- Saving Operated Video from a webcam using OpenCV
- OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
- Gun Detection using Python-OpenCV
- OpenCV Python Tutorial
- Python OpenCV: Meanshift
- Python OpenCV | cv2.copyMakeBorder() method
- Image Resizing using OpenCV | Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.