Image and Video Processing

Aditya Pande
2 min readJun 7, 2021

Task Description

- Create image by yourself Using Python Code

- Take 2 image crop some part of both image and swap it.

- Take 2 image and combine it to form single image. For example collage.

In this article, we will learn about about how image is created by writing python code and will also see how we can create our own image and also crop images and then swap them. Basically, an image is a 3D Array which is nothing but collection of pixels in which some values are stored. Similarly, a video is nothing but the collection of multiple images captured in sequential order. If we want to crop any image, then as image is an array we can do slicing operation on it and accordingly and crop this image according to our requirement. Thus, the operations that we perform on image and videos are known as Image and Video Processing. In python, we will use “opencv-python” library in order to to these operations and this library can be installed using “pip” command. Following are some functions I have used in performing this task:-

i) imread()-> This fucntion is used to read the image which is already stored in your directory so that we can store it’s output in some variable.

ii) imshow()-> This function will open a window and show you the image we have created or imported.

iii) waitKey()-> This function is used to hold the window untill the time we want it to show us image otherwise program will crash.

iv) destroyAllWindows()-> This function is used to terminate or kill the window which is displaying our image in order to save our program from being crashed.

v) zeros()-> This function will create an array which will have all its values as zero (null). It comes under numpy library.

vi) shape-> This keyword is used to see the dimensions or size of our array.

vii) hstack()-> This function is used to combine two or more arrays horizontally having same dimensions to form one single array. It also comes under numpy library.

Github URL:-

The below video shows the complete process for performing all these 3 tasks:-

--

--