Skip to content

oriolbernal/face-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

face-swap

Python script that swaps the faces from one or two images.

Getting Started

The project has been inspired by the following resources:

Demo

This is how the results look like:

Result

And what the script does:

  • First steps: Process

  • Calculate the new face: Process2

  • Swap the new faces and apply a color filter: Process3

Resources

Examples

We can swap the faces from one image:

import cv2
from face_swap import swap_faces

# Read images
img = cv2.imread("assets/img3.jpg")

# Swap faces
img_changed_faces = swap_faces(img)

# Show results
cv2.imshow("img_changed_faces", img_changed_faces)
cv2.waitKey(0)

Or we can also swap the faces from two images:

import cv2
from face_swap import swap_faces

# Read images
img = cv2.imread("assets/img1.jpg")
img2 = cv2.imread("assets/img2.jpg")

# Swap faces
img_changed_face, img2_changed_face = swap_faces(img, img2)

# Show results
cv2.imshow("img_changed_face", img_changed_face)
cv2.imshow("img2_changed_face", img2_changed_face)
cv2.waitKey(0)

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages