Py68FaceZones uses dlib and OpenCV (cv2) to process face images, detect 68 facial landmarks, draw custom cheek-region Bezier paths, and export cropped cheek areas.
- Automatically detects faces in an image.
- Draws all 68 dlib facial landmarks with index labels.
- Builds left and right cheek regions from facial landmarks using Bezier curves.
- Exports cropped cheek-region images for both sides of the face.
- Python 3.12
numpy<2opencv-python==4.8.1.78dlib-bin==19.24.2.post1imutils==0.5.4
Install the dependencies with:
python -m pip install -r requirements.txtshape_predictor_68_face_landmarks.dat: dlib 68-point facial landmark predictor file.res/: Directory for input images.res/result/: Directory for generated output images.
- Make sure all dependencies are installed and place
shape_predictor_68_face_landmarks.datin the project root. - Put the input image in the
res/directory. - Edit the
file_namevariable inmain.pyto specify the input filename without the extension. For example,file_name = "test"readsres/test.jpg. - Run the program:
python main.py- The generated images will be saved in
res/result/.
After execution, the following output files are generated in res/result/:
test_landmarks.jpg: The original face image with all 68 landmark points and their indices drawn on top. This is useful for verifying that face detection and landmark localization are working correctly.test_full.jpg: The original image with green Bezier curve outlines showing the left and right cheek regions.test_left_zone.jpg: The cropped left cheek region defined by the custom path. Pixels outside the selected region are filled with white.test_right_zone.jpg: The cropped right cheek region defined by the custom path, using the same extraction logic as the left side.
- If
shape_predictor_68_face_landmarks.datis missing, or the specified image does not exist inres/, the program will raise an error. - If no face is detected in the image, the program will report an error.



