Basic Image Processing

Awais Junaid
3 min readJun 9, 2021

Task 04 πŸ‘¨πŸ»β€πŸ’» Summer Program 2021

Task Description πŸ“„

πŸ”… Task 4.1 β€” πŸ“Œ Create image by yourself Using Python Code

πŸ”… Task 4.2 β€” πŸ“Œ Take 2 image crop some part of both image and swap it.

πŸ”… Task 4.3 β€” πŸ“Œ Take 2 image and combine it to form single image. For example collage

Before starting, let us know about the two important libraries which are going to be used in the following codes.

NumPy: It is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

OpenCV: It is a library of Python bindings designed to solve computer vision problems. All the OpenCV array structures are converted to and from Numpy arrays.

Task 4.1

To make a simple image using python, we’re going to use the following code:

Output:

Task 4.2

There are two images which is to be cropped and to swap their faces. The images are:

To crop and swap their faces, the code given below is written where the dimensions of each image is set in such a way that is cropped exactly from the place where the faces are. Those dimensions are taken manually by hit & trial method to chose the pixels for cropping the image.

Output:

Task 4.3

Now combining the same two images that was taken before and making it into a single image.

The following code is implemented to achieve the output.

Output:

GitHub Repo: https://github.com/AwaisJunaid/Summer2021/tree/main/Task%204

Team : Summer_6_14

Mohammed Adnan

Prattipati Sri Raviteja

Saami Abdul Samad

Mohammed Awais Ahmed

--

--