Skip to main content
    listerineh.dev
    • About
    • Experience
    • Projects
    • Skills
    • Blog
    • Talks
    • Contact
    • Why
    • About
    • Experience
    • Projects
    • Skills
    • Blog
    • Talks
    • Contact
    • Why

    © 2026 Sebastian Alvarez

    All projects

    LBPH Face Recognition

    Face recognition from a webcam with OpenCV: capture a person's face, train an LBPH model, and recognize them live, or say it is an unknown face.
    Source Code
    LBPH Face Recognition
    Role
    AI Developer
    Timeline
    February 2022
    Status
    Completed

    In numbers

    Face crops captured per person
    300300
    Square grayscale crops for training
    150150px
    Distance under which a face counts as known
    7070

    About the Project

    LBPH Face Recognition recognizes people from a webcam in three steps, each a small script. The first asks for a name, finds faces in the camera feed with a Haar cascade, and saves 300 grayscale crops of 150×150 pixels into that person's folder. The second trains an LBPH model with one label per person and saves it to a file. The third opens the camera, finds each face and asks the model who it is.

    LBPH, Local Binary Patterns Histograms, describes a face by the texture around each pixel instead of learning features with a deep network, so it trains in seconds on a laptop with a few hundred photos. The model returns a label and a distance; a face counts as recognized only when the distance is under 70, and anything else is drawn in red as an unknown face, so the system says it does not know rather than guessing a name.

    I built it in February 2022, at university, to understand classical face recognition before moving on to neural networks.

    Technologies
    1. AI

      • OpenCV
    2. API & backend

      • Python

    Relevance

    Classical computer vision done properly: data capture, training and live inference, with a threshold that prefers an honest "unknown" over a wrong answer.

    How it works

    The path a request takes, step by step.

    1. 01 · PersonPersonSits in front of the webcam
    2. 02 · ServiceHaar cascadeFinds faces in each frame
    3. 03 · DataCapture300 grayscale crops per person
    4. 04 · AI modelLBPHOne label per person, saved to a file
    5. 05 · ResultLive resultA name, or an unknown face

    Decisions

    The choices that shaped it, and what each one cost.

    1. 01

      LBPH instead of a deep network

      Why
      It describes faces by local texture, so it trains in seconds on a laptop from a few hundred photos.
      What it cost
      It handles pose and angle worse than learned embeddings, and every new person means training again.
    2. 02

      Prefer unknown over a wrong name

      Why
      A face only gets a name when the distance is under 70; everything else is drawn in red as unknown.
      What it cost
      The threshold is fixed by hand, so a known person in different light can show up as unknown.

    Next project

    Hand TrackingReal-time hand tracking with MediaPipe and OpenCV: 21 landmarks per hand and a square box around it, ready to crop for gesture recognition.Next project
    listerineh.dev

    Full-stack engineer building AI agents, cloud platforms and web products. Based in Quito, working remotely.

    Open to new projects

    Work

    • Projects
    • Experience
    • Skills
    • Blog
    • Talks

    About me

    • About
    • Why Listerineh?
    • Contact

    Connect

    • GitHub
    • LinkedIn
    • Instagram
    • Email

    © 2026 Sebastian Alvarez · All rights reserved.

    • Privacy Policy
    • Terms of Use
    • Unsubscribe from the newsletter
    • Component Library