This tutorial explains how to run two Python scripts that:
- Align faces in a set of images
- Draw facial landmark points on those faces
No prior experience with computer vision is required.
- Go to: https://www.anaconda.com/download
- Download Anaconda for your operating system (Windows / macOS / Linux)
- Install it using the default options
After installation, you should have:
- Anaconda Navigator
- Anaconda Prompt (Windows) or Terminal (macOS/Linux)
This keeps everything clean and avoids conflicts.
Open Anaconda Prompt / Terminal, then type:
conda create -n enviroment_name python=3.9Press Y when asked.
Activate the environment:
conda activate enviroment_nameYou should now see (enviroment_name) at the beginning of the line.
Run these commands one by one:
conda install -c conda-forge dlib
conda install opencv numpy
pip install imutilsdlib may take a few minutes to install — this is normal.
These scripts need a pre-trained face model.
- Download this file: http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
- Unzip it
- Place the file
shape_predictor_68_face_landmarks.datin the same folder as the Python scripts
Your folder should look like this:
face-project/
├── face-aligner.py
├── face-points.py
├── face-points-only.py
├── shape_predictor_68_face_landmarks.dat
├── input/
│ ├── image1.jpg
│ ├── image2.jpg
│ └── ...
- Put portrait photos (JPG or PNG) inside the
inputfolder - Images should contain one face per image
In the terminal, navigate to your project folder:
cd path/to/face-projectThen run:
python face-aligner.pyThis will:
- Detect faces
- Rotate and center them
- Save the results into a new folder called:
faces/
Now run:
python face-points.pyThis will:
- Read the aligned faces
- Detect facial landmarks
- Draw colored points on the face
- Save the results into:
faces-points/
face-points-only.py will return only the colored points without the faces.
After everything runs, you should have:
faces/ → normalized portraits
faces-points/ → portraits with facial landmarks
These images show how a face is interpreted not as an identity, but as a set of measurable points.