FaceSwap is an application designed for swapping faces in images using deep learning and image processing techniques. The application provides both sequential and multithreading processing for optimized performance. The user interface is built with Tkinter and includes a demo UI to visualize the face-swapping process.
The application leverages OpenCV and Dlib for face detection and alignment, ensuring precise and seamless face swaps. Additionally, it supports parallel processing with multithreading to handle multiple image pairs efficiently.
- Programming Language: Python
- Libraries: OpenCV, Dlib, NumPy, Tkinter
- Parallel Processing: ThreadPoolExecutor for multithreading
- UI Framework: Tkinter
Follow these steps to set up the project locally:
git clone https://github.com/swiftmg0d/FaceSwapApplication.git
cd FaceSwapApplication
Ensure you have Python installed, then install the required libraries:
pip install opencv-python dlib numpy
The application requires the shape_predictor_68_face_landmarks.dat
file for facial landmark detection. Download it from Dlib's official website and place it in the assets/
directory.
To start the FaceSwap application, navigate to the faceswap directory:
cd demo/faceswap
To run the application, click on:
demo_application.exe
- Face Detection: Uses Dlib's pre-trained model for detecting and aligning faces.
- Face Landmarking: Extracts key facial points for seamless face blending.
- Sequential & Multithreading: Supports both single-threaded and multithreaded processing for efficient face swapping.
- User Interface: Built with Tkinter, offering an easy-to-use demo UI.
- Parallel Processing: Uses
ThreadPoolExecutor
to process multiple face swaps simultaneously. - Error Handling: Robust exception handling for missing faces or processing errors.
- High-Quality Output: Optimized blending and color correction for realistic results.
The parallel and sequential processing code are located in:
source-code/faceswap/
single.py
: Contains the sequential face-swapping logic.multi.py
: Contains the multithreading implementation for faster processing.
This application is ideal for fun projects, research, and image editing. Enjoy seamless and efficient face swapping with FaceSwap!