LINUX WORLD/SUMMER TRAINING 2021

TASK: 4

USES OF OPENCV IN PYTHON FOR

COMPUTER VISION

Introduction

We have three different tasks at hand in this task-

Task 4.1 : Creating your own image using opencv functions in python.

A . We first import the numpy module and then the cv2 module. Further we assign the variable photo to the function which creates it as a black image, and we pass the command to show the image after this step.

B . Then we similarly pass different comments to create lines or rectangles on the black

image and then display the output after each step.

As seen we have successfully created a Hut image by using the cv2 functions.

Task 4.2 : Take two images, cropping a part of it and swap with each other.

Using the above code we take two images, crop a part of one and swap it with the other one.

Originals:

Result:

Task 4.3 : Take two images and merge both

Here we input two pictures, display them individually first then merge them both and display it as a single image using concat function.

Brahmanshu Tripathi

brahmanshutripathi@gmail.com

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store