Image Processing using Computer Vision — OpenCV

3 min readJun 9, 2021


Computer vision is the field of computer science that focuses on replicating parts of the complexity of the human vision system and enabling computers to identify and process objects in images and videos in the same way that humans do. Until recently, computer vision only worked in limited capacity.

Due to advances in artificial intelligence and innovations in deep learning and neural networks, the field has been able to take great leaps in recent years and has been able to surpass humans in some tasks related to detecting and labeling objects.

One of the driving factors behind the growth of computer vision is the amount of data we generate today that is then used to train and make computer vision better.

Task 4.1 →Create image by yourself Using Python Code

Computer can’t understand image as such ,they could only understand anything in the form of numbers. So we need to convert every images into array of numbers. Each array element has a unique value which is the combination of RGB. In order to convert images in the form arrays we use numpy library.

To do basic operations like read and edit pixel values, working with image and to perform basic arithmetic operations we use opencv library which provides functions to the operations.

  • cv2.imshow() method is used to display an image in a window.
  • cv2.waitkey() will display the window infinitely until any keypress
  • cv2.destroyAllWindows() simply destroys all the windows we created.
Code for creating a custom image.

Task 4.2 →Take 2 image crop some part of both image and swap it.

cv2.imread() method loads an image from the specified file.

With the help of imread() function we get two images and we want

Code for cropping a image and swapping it.
These are the two images in which we are going to perform the task.

Task 4.3 → Take 2 image and combine it to form single image.

For this we have to keep the size of the image same, if both images are of different size we can use the cv2.resize() function to change the size of the image according to our need.

Code to perform Concatenation
These are the two images in which we are going to perform Concatenation
Two images are concatenated .

Thank you!!