fhennig / face-of-the-crowd

An interactive art installation using facial recognition.
MIT License
6 stars 0 forks source link

Transform and scale face using face landmarks. #2

Closed fhennig closed 5 years ago

fhennig commented 5 years ago

When an image is saved, before it is saved, it should be scaled and maybe rotated and/or "prespective distorted" to make every face more similar in alignment.

Something like this: https://www.pyimagesearch.com/2017/05/22/face-alignment-with-opencv-and-python/

In the end the saved images should be able to just align smoothly.

fhennig commented 5 years ago

https://www.learnopencv.com/average-face-opencv-c-python-tutorial/

fhennig commented 5 years ago

Alpha blending: https://www.learnopencv.com/alpha-blending-using-opencv-cpp-python/

Affine transform: https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html

delauny thingie: https://www.learnopencv.com/delaunay-triangulation-and-voronoi-diagram-using-opencv-c-python/

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

average face: https://www.learnopencv.com/average-face-opencv-c-python-tutorial/

head pose: https://www.learnopencv.com/head-pose-estimation-using-opencv-and-dlib/

fhennig commented 5 years ago

implemented with a simple affine transform.

Next step is to implement it by mapping all the face landmarks as described in here.

fhennig commented 5 years ago

For a collection of images/faces:

  1. average out all landmark locations to receive the target locations for the landmarks.
  2. for each image create the delaunay sibdivisions and get the triangles.
  3. for each triangle create an affine transformation and map it to the target locations.
fhennig commented 5 years ago

All face landmarks are mapped now 919f442f1530f00a1369e8295aa6c14c4b15bc9d