The FaceMask_Augmentation
tool is designed to help users create and adjust facial masks for image augmentation. It enables interactive marking and adjustment of points on facial images to generate custom masks.
2023-12-20.17-43-08.mp4
- Python 3.x
- OpenCV
- NumPy
- Pillow (PIL)
Install the required dependencies using the following command:
pip install opencv-python numpy pillow
- Clone the Repository:
git clone https://github.com/khengyun/FaceMask_Augmentation.git
- Navigate to the Project Directory:
cd FaceMask_Augmentation
-
Run the Face Mask Augmentation Tool:
- To create and adjust masks for images in the mask_images directory:
python CreateMaskPTS.py
- Follow the on-screen instructions to mark and adjust points on each image. Press ESC to finish the adjustment.
-
Review Adjustments:
- The adjusted mask points are stored in the
mask_pts.pkl
file.
- The adjusted mask points are stored in the
-
Run the Face Masking Script:
- After generating mask points, use the FaceMasking.py script to visualize the masks on a live camera feed.
python FaceMasking.py
- Adjust the camera index if needed (
cam = cv2.VideoCapture(0)
). - Press 'ESC' to exit the live camera feed.
-
Further Customization:
- You can customize the script by adjusting parameters and file paths directly in the
FaceMasking.py
file.
- You can customize the script by adjusting parameters and file paths directly in the
- While adjusting points, pressing the Shift key allows you to drag all points simultaneously.
- The script uses the
MTCNNFaceDetector
for face detection, replacing the previousFaceDetector
. - Adjust the camera index in the script (
cam = cv2.VideoCapture(0)
) based on your setup.