Prerequisites: Introduction to OpenCV
Most of us have already captured image using countdown timer with our phones. We can do the same thing on our computer with the help of OpenCV.
But here we can specify the countdown timer instead of choosing one of the specified countdown and whenever the particular key will be pressed (let’s say q) the countdown timer will be started and we will be displaying the countdown on our camera with the help of cv2.putText() function and when it reaches zero we will capture the image, display the captured image for fixed number of seconds (according to our need ) and write/save the image on disk. Now let’s see how to perform this task:
- First, we will be setting the initial value of Countdown timer in second. (We can also take this as input from user).
- Open the camera and create a video Capture object using cv2.VideoCapture().
- While camera is open
- We will read each frame and display it using cv2.imshow().
- Now we will set a key (we use q ) for the countdown to begin.
- As soon as this key will be pressed, we will start the Countdown.
- We will be keeping track of countdown with the help of time.time() function and display the countdown on the video using cv2.putText() function.
- When it reaches zero, we will copy the current frame and write the current frame at desired location on disk by using cv2.imwrite() function.
- On pressing ‘Esc’ we will close the camera.
Below is the implementation.
- How To Create a Countdown Timer Using Python?
- Create Countdown Timer using Python-Tkinter
- Opening multiple color windows to capture using OpenCV in Python
- Python OpenCV: Capture Video from Camera
- Capture all the options in Selenium with Python
- Timer Application using PyQt5
- How to show a timer on screen using arcade in Python3?
- Timer Objects in Python
- Python Program to Create a Lap Timer
- PyQt5 QCalendarWidget - Setting Start Timer
- PyQt5 QCalendarWidget - Setting Timer Event
- PyQt5 QCalendarWidget - Killing the timer
- Image-to-Image Translation using Pix2Pix
- Mahotas - Labelled Image from the Normal Image
- Converting an image to ASCII image in Python
- PyQt5 – How to get cropped square image from rectangular image ?
- PyQt5 – How to create circular image from any image ?
- Mahotas - Reconstructing image from transformed Daubechies wavelet image
- Multi-Label Image Classification - Prediction of image labels
- Image processing with Scikit-image in 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 email@example.com. 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.
Improved By : Akanksha_Rai