What this visualizer does
It runs MediaPipe FaceLandmarker and overlays dense facial geometry: tessellation, contours, landmark points, and a face bounds guide.
Computer vision visualizer
Track dense facial landmarks, contours, blendshapes, and 3D-style face geometry in the browser with MediaPipe.
Face mesh works best when the full face is visible. Contours make eyes, lips, and face oval easier to inspect.
It runs MediaPipe FaceLandmarker and overlays dense facial geometry: tessellation, contours, landmark points, and a face bounds guide.
import mediapipe as mp
BaseOptions = mp.tasks.BaseOptions
VisionRunningMode = mp.tasks.vision.RunningMode
FaceLandmarker = mp.tasks.vision.FaceLandmarker
FaceLandmarkerOptions = mp.tasks.vision.FaceLandmarkerOptions
options = FaceLandmarkerOptions(
base_options=BaseOptions(model_asset_path="face_landmarker.task"),
running_mode=VisionRunningMode.IMAGE,
num_faces=1,
output_face_blendshapes=True
)
with FaceLandmarker.create_from_options(options) as landmarker:
result = landmarker.detect(mp.Image.create_from_file("face.jpg"))
print(len(result.face_landmarks[0]))Landmark x and y values are normalized to image width and height. The z value estimates depth relative to the face and is useful for 3D-style effects.
For best results, keep your face centered, avoid heavy occlusion, and use face detection first when you only need boxes instead of detailed facial geometry.