ML Operation’s With Images By Using CV2 And NumPy

Prateek Mishra
3 min readJul 18, 2021

In this article I discussed about :-

  1. How to crop images .
  2. How to replace crop images .
  3. How to make photo frame by cv2.
  4. How to make collage.

PART 1 :- How To Crop Images

This Is Full Image Of MSD.

Cool MSD

This Is A Code For Crop The Image

Crop Image Code

Output Of Above Code

Crop Face Of MSD

PART 2 :- How To Replace The Face Of Two Images

Now in this portion I will replace the face of msd with sushant singh rajpoot.

So now I will crop the face of sushant in this portion.

This Is Full Image Of Sushant.

Sushant

This Is A Code For Crop The Image

Crop Image Code

Output Of Above Code

Crop Face Of Sushant

Replace Sushant Face with MSD

code:-

Replace Face Of Sushant

Output Of Above Code

Replace Face

Replace MSD Face with Sushant

Code :-

code

Output :-

Replace Face

PART 3:- How To Make Photo Frame By Cv2

Code :-

image code

Output Of Above Code

Image

PART4:- How To Make Collage

Horizontal Collage:-

Code:-

code 1
code 2

Output Of Above Code

collage pic

…………………………………..Thank You………………………………………..

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Prateek Mishra
Prateek Mishra

Written by Prateek Mishra

I am a tech enthusiast who thrives on experimenting with cutting-edge technologies

No responses yet

Write a response