This application helps in choosing your custom face for a 3-D model that's deplloyed in a Unread Meta-Verse, as now apart from manually customizing your charachter you can just click a pic and use that pic on the face of your charachter. ๐ฏ This is a Flask web application that detects facial features (eyes, nose, and mouth) in an image, overlaps a second image without rectangles around the features, and saves the updated overlapped image.
๐ Objective:
The main objective of this application is to overlap a second image onto the first image, considering the facial features detected in the first image. The second image serves as the background, and the first image is overlaid on top, ensuring the facial features align properly. With the help of this you would be able to replace the face of a 3-D model in the metaverse with your own clicked photos.
๐ ๏ธ Technologies and Libraries:
- Python
- Flask
- OpenCV(cv2)
๐ผ๏ธ How It Works:
- The user uploads an image through the
/process_image
endpoint. - The application detects facial features (eyes, nose, and mouth) in the uploaded image using OpenCV's Haar cascades.
- The first image (processed image) is then overlapped onto a second image (background image) without any rectangles around the detected facial features.
- The updated overlapped image is saved and returned as a response.
โ๏ธ Setup and Usage:
- Clone this repository to your local machine.
- Install the required libraries listed in
requirements.txt
. - Run the Flask application using
python app.py
. - Use Postman or any API testing tool to send a POST request to
http://localhost:5000/process_image
with the image file attached.
๐ Directory Structure:
main.py
: Contains the Flask web application code.haarcascades/
: Directory containing the Haar cascade classifiers for face, eyes, nose, and mouth detection.Unknown.jpg
: The second image (background image) you want to overlap with the first image.
๐ท Sample Images:
The sample images used in this repository are for demonstration purposes only. Feel free to replace Unknown.jpg
with your own second image for experimentation.
You can check the final result images in result folder name main.png
. That png can be used to replace the face of any 3-D model.
๐จ Important Note:
- The application assumes that the uploaded image contains at least one face. If no face is detected, it will return an error.
- For best results, ensure that the second image (background image) has a face of similar size and orientation as the first image.
๐ License:
This project is licensed under the MIT License.
๐ฉโ๐ป Author:
Happy overlapping ๐