# mstfydz/opencv-anlik-yuz-tanima architecture

> Architecture diagram of the GitHub repository mstfydz/opencv-anlik-yuz-tanima, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mstfydz/opencv-anlik-yuz-tanima
- Repository: https://github.com/mstfydz/opencv-anlik-yuz-tanima

## Overview

This is a small OpenCV real-time face-recognition application, organized as separate scripts for collecting face samples, training a recognizer, and identifying faces from a live camera. Its main workflow saves detected face crops in `veriseti`, trains an LBPH model, then loads that model during live recognition and overlays names and confidence. The README confirms camera-based recognition; the included cascade files support face detection. The `egitim` model directory is referenced by code but is absent from the supplied tree.

Main entry points: [`02_yuz_egitimi.py`](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/02_yuz_egitimi.py) (Train Model), [`01_yuz_veriseti.py`](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/01_yuz_veriseti.py) (Capture Faces), [`Cascades/haarcascade_frontalface_default.xml`](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/Cascades/haarcascade_frontalface_default.xml) (Face Cascade), [`veriseti`](https://github.com/mstfydz/opencv-anlik-yuz-tanima/tree/main/veriseti) (Face Dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Sample Capture"]
  node_capture_faces["Capture Faces<br/>[01_yuz_veriseti.py]"]
  node_dataset[("Face Dataset")]
end

subgraph group_training["Model Training"]
  node_train_model["Train Model<br/>[02_yuz_egitimi.py]"]
  node_model[("LBPH Model")]
end

subgraph group_recognition["Live Recognition"]
  node_recognize["Recognize Faces"]
  node_text_overlay["Text Overlay"]
end

subgraph group_support["Camera Support"]
  node_face_cascade["Face Cascade"]
  node_eye_cascade["Eye Cascade"]
  node_camera_test["Camera Preview<br/>[simpleCamTest.py]"]
end

node_operator(("Operator"))
node_camera["Camera"]

node_operator -->|"starts capture"| node_capture_faces
node_camera -->|"provides frames"| node_capture_faces
node_capture_faces -->|"detects faces"| node_face_cascade
node_capture_faces -->|"writes crops"| node_dataset
node_operator -->|"starts training"| node_train_model
node_train_model -->|"reads samples"| node_dataset
node_train_model -->|"detects faces"| node_face_cascade
node_train_model -->|"writes model"| node_model
node_operator -->|"starts recognition"| node_recognize
node_camera -->|"provides frames"| node_recognize
node_recognize -->|"detects faces"| node_face_cascade
node_recognize -->|"reads model"| node_model
node_recognize -->|"renders labels"| node_text_overlay
node_operator -->|"starts preview"| node_camera_test
node_camera -->|"provides frames"| node_camera_test

click node_capture_faces "https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/01_yuz_veriseti.py"
click node_face_cascade "https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/Cascades/haarcascade_frontalface_default.xml"
click node_dataset "https://github.com/mstfydz/opencv-anlik-yuz-tanima/tree/main/veriseti"
click node_train_model "https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/02_yuz_egitimi.py"
click node_eye_cascade "https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/Cascades/haarcascade_eye.xml"
click node_camera_test "https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/simpleCamTest.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_faces,node_dataset toneBlue
class node_train_model,node_model toneAmber
class node_recognize,node_text_overlay toneMint
class node_face_cascade,node_eye_cascade,node_camera_test toneRose
class node_operator,node_camera toneIndigo
```

## Components

### Sample Capture

- [Capture Faces](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/01_yuz_veriseti.py): `01_yuz_veriseti.py`
- [Face Dataset](https://github.com/mstfydz/opencv-anlik-yuz-tanima/tree/main/veriseti): `veriseti`

### Model Training

- [Train Model](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/02_yuz_egitimi.py): `02_yuz_egitimi.py`
- **LBPH Model**

### Live Recognition

- **Recognize Faces**
- **Text Overlay**

### Camera Support

- [Face Cascade](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/Cascades/haarcascade_frontalface_default.xml): `Cascades/haarcascade_frontalface_default.xml`
- [Eye Cascade](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/Cascades/haarcascade_eye.xml): `Cascades/haarcascade_eye.xml`
- [Camera Preview](https://github.com/mstfydz/opencv-anlik-yuz-tanima/blob/main/simpleCamTest.py): `simpleCamTest.py`

### Other components

- **Operator**
- **Camera**

## Connections

- Operator → Capture Faces: starts capture (evidence: `01_yuz_veriseti.py`)
- Camera → Capture Faces: provides frames (evidence: `01_yuz_veriseti.py`)
- Capture Faces → Face Cascade: detects faces (evidence: `01_yuz_veriseti.py`)
- Capture Faces → Face Dataset: writes crops (evidence: `01_yuz_veriseti.py`)
- Operator → Train Model: starts training (evidence: `02_yuz_egitimi.py`)
- Train Model → Face Dataset: reads samples (evidence: `02_yuz_egitimi.py`)
- Train Model → Face Cascade: detects faces (evidence: `02_yuz_egitimi.py`)
- Train Model → LBPH Model: writes model (evidence: `02_yuz_egitimi.py`)
- Operator → Recognize Faces: starts recognition
- Camera → Recognize Faces: provides frames
- Recognize Faces → Face Cascade: detects faces
- Recognize Faces → LBPH Model: reads model
- Recognize Faces → Text Overlay: renders labels
- Operator → Camera Preview: starts preview (evidence: `simpleCamTest.py`)
- Camera → Camera Preview: provides frames (evidence: `simpleCamTest.py`)
