Image Processing using Computer Vision

Amit Pandey
3 min readJun 8, 2021

Computer Vision Concept plays huge role in image processing under Machine Learning. This concept gives free hand to conceptualize the modification in image or video.

For this ,here we use the library called OpenCV.

📌 Task 4.1 — Create image by yourself Using Python Code :

For this ,at first we must understand the concept of image in machine learning ,the machine understood every image as array and each section of array has some unique values which are the combination of RGB but in OpenCV it reverses as BGR and each pixel consists of the values of these three colours (which is Red ,Green and Blue).

Note :- 1 pixel size is equal to 1/96th part of a inch.

For task at first we must need to install and import numpy and cv2 library. If installing numpy library shows error stated -“ No module named skbuild “, in this case try to upgrade your pip using pip install — upgrade pip and try installing once again. Once both the libraries are installed we can continue the process of image processing using the assigned libraries.

Here we are trying to create the image of Sun.Hence the code and picture are given below :

Code for Customizing the sun
Created image of Sun using Python Code

🔅 Task 4.2
📌 Take 2 image crop some part of both image and swap it :

Here the Code with cropped and swapped images using Python ML libraries:

Uncropped and Unswapped images
Code of cropping and swapping images
Cropped and Swapped images

🔅 Task 4.3
📌 Take 2 image and combine it to form single image :

For this we have to keep the image size same ,if the image size is not same then we use the function cv2.resize() to change the size of the image according to our need for the collage.

Code for Combing two image and making it as collage :

Code for Combining two image

Final image :

final Collage of two image

All above are the complete view of creating image , cropping two images and embed each other’s cropped part and then making collage from those initial images.

Thank You

— — — — — — — —

--

--