Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Face morphing using opencv

Can I get some ideas on how to morph the face in a live video using opencv? I have tried Face substitution but it is implemented using openFrameworks.

I would like to implement the same using opencv. Is there any other methods available in opencv than diirectly porting Face substituion code from openFrameworks to Opencv?

I have also gone through this link, but few people have mentioned as the face morphing is deprecated in opencv?

like image 735
2vision2 Avatar asked Jun 12 '14 13:06

2vision2


People also ask

How does face morphing work?

The face morphing algorithm morphs between faces using a common set of feature points, placed by hand on each face. To morph between two faces, you need to warp both faces to a common shape so they can be blended together.


1 Answers

I recently wrote an article on face morphing using OpenCV. I have shared the code in C++ / Python. You can find the details here

http://www.learnopencv.com/face-morph-using-opencv-cpp-python/

but the basic idea is as follows.

  1. Find Point Correspondences in the two input images.
  2. Do Delaunay triangulation on the points.
  3. The amount of morphing is controlled by a parameter alpha. E.g .for alpha = 0, you will get Ted Cruz in the example below, and for alpha = 1. you will get Hillary Clinton. For any other alpha, it will be the blend between the two. Use alpha to calculate the location of the points in the output ( morphed ) image by taking a weighted average of the two input image points.
  4. Calculate the affine transform between every triangle in the input images and the destination image ( morphed image ).
  5. Warp triangle from each input images to the output image, and blend the pixels based on alpha. Do this for every triangle and you get the output morphed image.

Hope this helps.

enter image description here

like image 148
Satya Mallick Avatar answered Sep 20 '22 09:09

Satya Mallick