What this visualizer does
It runs MediaPipe FaceDetector on an image or live webcam frame and draws the detected face rectangle, confidence score, and facial keypoints over the preview.
Computer vision visualizer
Detect faces, bounding boxes, confidence scores, and key face points directly in the browser with MediaPipe.
The model runs locally in the browser. Use a frontal, well-lit face for the most stable bounding box.
It runs MediaPipe FaceDetector on an image or live webcam frame and draws the detected face rectangle, confidence score, and facial keypoints over the preview.
import mediapipe as mp
import cv2
mp_face_detection = mp.solutions.face_detection
with mp_face_detection.FaceDetection(
model_selection=0,
min_detection_confidence=0.5
) as detector:
image = cv2.imread("face.jpg")
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
results = detector.process(rgb)
if results.detections:
for detection in results.detections:
print(detection.score, detection.location_data)Bounding boxes are returned in pixels. Keypoints are normalized, so the overlay multiplies them by the current image or video width and height before drawing.
If detection is unstable, lower the confidence threshold, improve lighting, and keep the full face visible. Face mesh is better when you need detailed geometry.