Swap Faces Using OpenCV

Generated Image

Time to swap faces!

  • haarcascade_frontalface_default.xml is the pre-trained model that I have used which helps me find the coordinates of the face. You can find the same here
  • p1x1, p2x2 etc. are all the coordinates of the faces of photo 1 and 2.
  • cphoto1 and cphoto2 are the cropped photos. tcphoto2 is kind of a temporary image which accompanies us in the swap.
  • In the for loops then the cropped photos are swapped, so that the faces can be swapped.

Unlisted

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

MLOps: Maturity Levels for Automation in Machine learning

Natural Language Processing: Experimenting spaCy and updating the model (Part 5)

How to make the most of data surplus — domain adaptation

TensorFlow 1.x vs 2.x.

Major Benefits To Use of Machine Learning in Software Testing

Training a double-jointed arm with DDPG — Deep Reinforcement Learning

Machine Learning — An Error by Any Other Name…

Set up Serverless Store: Part 2 (Machine Learning/API, Data Analytics, and Data Visualization)

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