As we know OpenCV is a widely used library for image processing. It provides a wide sense of image processing. Let’s see how to create video using multiple images using OpenCV.
Install the following libraries:
Also, check the path before running the code otherwise you will be full with errors.
How it works ?
Using PIL library we are opening images and resizing them to their mean_height and mean_width because the video which will be created using cv2 library required the input images of same height and width.
Resized images are included in an array and frame of video is set with the mean_height and mean_width. Then by looping, we are appending each image to that frame.
Below is the implementation :
Get the link to the input images used and output video from here.
If we want more effects, sound with the video then it will be good to use the
ffmpeg python library which offers this kind of functionalities.
- Python | Grayscaling of Images using OpenCV
- Python | Denoising of colored images using opencv
- Addition and Blending of images using OpenCV in Python
- Erosion and Dilation of images using OpenCV in python
- Extract images from video in Python
- Arithmetic Operations on Images using OpenCV | Set-2 (Bitwise Operations on Binary Images)
- Python | Play a video using OpenCV
- Opening multiple color windows to capture using OpenCV in Python
- Python | Play a video in reverse mode using OpenCV
- OpenCV Python program for Vehicle detection in a Video frame
- Draw geometric shapes on images using OpenCV
- Stitching input images (panorama) using OpenCV with C++
- Arithmetic Operations on Images using OpenCV | Set-1 (Addition and Subtraction)
- OpenCV | Loading Video
- OpenCV C++ Program to create a single colored blank image
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.