# david-luk4s/reconhecimento-facial architecture

> Architecture diagram of the GitHub repository david-luk4s/reconhecimento-facial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/david-luk4s/reconhecimento-facial
- Repository: https://github.com/david-luk4s/reconhecimento-facial

## Overview

Reconhecimento Fácil OpenCV captures face samples from a webcam, trains face-recognition models, then runs one of three webcam recognizers. The graph preserves the separate capture, training, and recognition stages and their model artifacts. The README documents the overall sequence; source excerpts show the concrete file reads, writes, and detector setup. The FisherFaces recognizer expects a classifier file that is absent from the supplied tree, so that artifact is shown as an expected, not repository-present, resource.

Main entry points: [`reconhecedor_eigenfaces.py`](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_eigenfaces.py) (EigenFaces recognition), [`reconhecedor_fisherfaces.py`](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_fisherfaces.py) (FisherFaces recognition), [`reconhecedor_lbph.py`](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_lbph.py) (LBPH recognition), [`detect_face.py`](https://github.com/david-luk4s/reconhecimento-facial/blob/master/detect_face.py) (Sample capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Face capture"]
  node_capture_app["Sample capture<br/>[detect_face.py]"]
  node_face_cascade["Face cascade"]
  node_eye_cascade["Eye cascade"]
  node_samples[("Captured face samples")]
end

subgraph group_training["Model training"]
  node_trainer["Model training<br/>[treinamento.py]"]
  node_eigen_model["EigenFaces model"]
  node_lbph_model["LBPH model"]
  node_fisher_model["FisherFaces model file"]
end

subgraph group_recognition["Face recognition"]
  node_eigen_recognizer["EigenFaces recognition"]
  node_fisher_recognizer["FisherFaces recognition"]
  node_lbph_recognizer["LBPH recognition"]
  node_recognition_output["Label and confidence overlay"]
end

node_user(("User"))
node_camera(("Webcam"))

node_user -->|"starts capture"| node_capture_app
node_camera -->|"streams frames"| node_capture_app
node_capture_app -->|"loads detector"| node_face_cascade
node_capture_app -->|"loads detector"| node_eye_cascade
node_capture_app -->|"writes samples"| node_samples
node_user -->|"starts training"| node_trainer
node_samples -->|"reads images"| node_trainer
node_trainer -->|"writes model"| node_eigen_model
node_trainer -->|"writes model"| node_lbph_model
node_user -->|"chooses algorithm"| node_eigen_recognizer
node_user -->|"chooses algorithm"| node_fisher_recognizer
node_user -->|"chooses algorithm"| node_lbph_recognizer
node_camera -->|"streams frames"| node_eigen_recognizer
node_camera -->|"streams frames"| node_fisher_recognizer
node_camera -->|"streams frames"| node_lbph_recognizer
node_eigen_recognizer -->|"loads detector"| node_face_cascade
node_eigen_recognizer -->|"loads detector"| node_eye_cascade
node_fisher_recognizer -->|"loads detector"| node_face_cascade
node_fisher_recognizer -->|"loads detector"| node_eye_cascade
node_lbph_recognizer -->|"loads detector"| node_face_cascade
node_lbph_recognizer -->|"loads detector"| node_eye_cascade
node_eigen_recognizer -->|"loads model"| node_eigen_model
node_lbph_recognizer -->|"loads model"| node_lbph_model
node_fisher_recognizer -->|"loads expected model"| node_fisher_model
node_eigen_recognizer -->|"draws results"| node_recognition_output
node_fisher_recognizer -.->|"draws results"| node_recognition_output
node_lbph_recognizer -.->|"draws results"| node_recognition_output

click node_capture_app "https://github.com/david-luk4s/reconhecimento-facial/blob/master/detect_face.py"
click node_face_cascade "https://github.com/david-luk4s/reconhecimento-facial/blob/master/cascade/haarcascade_frontalface_default.xml"
click node_eye_cascade "https://github.com/david-luk4s/reconhecimento-facial/blob/master/cascade/haarcascade-eye.xml"
click node_trainer "https://github.com/david-luk4s/reconhecimento-facial/blob/master/treinamento.py"
click node_eigen_model "https://github.com/david-luk4s/reconhecimento-facial/blob/master/classifier/classificadorEigen.yml"
click node_lbph_model "https://github.com/david-luk4s/reconhecimento-facial/blob/master/classifier/classificadorLBPH.yml"
click node_fisher_model "https://github.com/david-luk4s/reconhecimento-facial/tree/master/classifier"
click node_eigen_recognizer "https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_eigenfaces.py"
click node_fisher_recognizer "https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_fisherfaces.py"
click node_lbph_recognizer "https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_lbph.py"
click node_recognition_output "https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_eigenfaces.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_capture_app,node_face_cascade,node_eye_cascade,node_samples,node_user toneBlue
class node_trainer,node_eigen_model,node_lbph_model,node_fisher_model toneAmber
class node_eigen_recognizer,node_fisher_recognizer,node_lbph_recognizer,node_recognition_output toneMint
class node_camera toneIndigo
```

## Components

### Face capture

- [Sample capture](https://github.com/david-luk4s/reconhecimento-facial/blob/master/detect_face.py): `detect_face.py`
- [Face cascade](https://github.com/david-luk4s/reconhecimento-facial/blob/master/cascade/haarcascade_frontalface_default.xml): `cascade/haarcascade_frontalface_default.xml`
- [Eye cascade](https://github.com/david-luk4s/reconhecimento-facial/blob/master/cascade/haarcascade-eye.xml): `cascade/haarcascade-eye.xml`
- **Captured face samples**

### Model training

- [Model training](https://github.com/david-luk4s/reconhecimento-facial/blob/master/treinamento.py): `treinamento.py`
- [EigenFaces model](https://github.com/david-luk4s/reconhecimento-facial/blob/master/classifier/classificadorEigen.yml): `classifier/classificadorEigen.yml`
- [LBPH model](https://github.com/david-luk4s/reconhecimento-facial/blob/master/classifier/classificadorLBPH.yml): `classifier/classificadorLBPH.yml`
- [FisherFaces model file](https://github.com/david-luk4s/reconhecimento-facial/tree/master/classifier): `classifier`

### Face recognition

- [EigenFaces recognition](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_eigenfaces.py): `reconhecedor_eigenfaces.py`
- [FisherFaces recognition](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_fisherfaces.py): `reconhecedor_fisherfaces.py`
- [LBPH recognition](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_lbph.py): `reconhecedor_lbph.py`
- [Label and confidence overlay](https://github.com/david-luk4s/reconhecimento-facial/blob/master/reconhecedor_eigenfaces.py): `reconhecedor_eigenfaces.py`

### Other components

- **User**
- **Webcam**

## Connections

- User → Sample capture: starts capture (evidence: `README.md`)
- Webcam → Sample capture: streams frames (evidence: `detect_face.py`)
- Sample capture → Face cascade: loads detector (evidence: `detect_face.py`)
- Sample capture → Eye cascade: loads detector (evidence: `detect_face.py`)
- Sample capture → Captured face samples: writes samples (evidence: `detect_face.py`)
- User → Model training: starts training (evidence: `README.md`)
- Captured face samples → Model training: reads images (evidence: `treinamento.py`)
- Model training → EigenFaces model: writes model (evidence: `treinamento.py`)
- Model training → LBPH model: writes model (evidence: `treinamento.py`)
- User → EigenFaces recognition: chooses algorithm (evidence: `README.md`)
- User → FisherFaces recognition: chooses algorithm (evidence: `README.md`)
- User → LBPH recognition: chooses algorithm (evidence: `README.md`)
- Webcam → EigenFaces recognition: streams frames (evidence: `reconhecedor_eigenfaces.py`)
- Webcam → FisherFaces recognition: streams frames (evidence: `reconhecedor_fisherfaces.py`)
- Webcam → LBPH recognition: streams frames (evidence: `reconhecedor_lbph.py`)
- EigenFaces recognition → Face cascade: loads detector (evidence: `reconhecedor_eigenfaces.py`)
- EigenFaces recognition → Eye cascade: loads detector (evidence: `reconhecedor_eigenfaces.py`)
- FisherFaces recognition → Face cascade: loads detector (evidence: `reconhecedor_fisherfaces.py`)
- FisherFaces recognition → Eye cascade: loads detector (evidence: `reconhecedor_fisherfaces.py`)
- LBPH recognition → Face cascade: loads detector (evidence: `reconhecedor_lbph.py`)
- LBPH recognition → Eye cascade: loads detector (evidence: `reconhecedor_lbph.py`)
- EigenFaces recognition → EigenFaces model: loads model (evidence: `reconhecedor_eigenfaces.py`)
- LBPH recognition → LBPH model: loads model (evidence: `reconhecedor_lbph.py`)
- FisherFaces recognition → FisherFaces model file: loads expected model (evidence: `reconhecedor_fisherfaces.py`)
- EigenFaces recognition → Label and confidence overlay: draws results (evidence: `reconhecedor_eigenfaces.py`)
- FisherFaces recognition → Label and confidence overlay: draws results
- LBPH recognition → Label and confidence overlay: draws results
