# liuruoze/easypr architecture

> Architecture diagram of the GitHub repository liuruoze/easypr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liuruoze/easypr
- Repository: https://github.com/liuruoze/easypr

## Overview

##### Main System Components

a. Core Recognition Pipeline:
- Plate Detection Module
- Character Recognition Module
- Training Module
- Utility Services

b. External Dependencies:
- OpenCV Integration
- Third-party Libraries (LBP, MSER, SVM, etc.)

##### Detailed Component Breakdown

A. Plate Detection Pipeline:
**Input Image → Plate Locate → Plate Judge → Plate Detect**

B. Character Recognition Pipeline:
**Detected Plate → Chars Segment → Chars Identify → Final Recognition**

C. Training System:
- ANN Training
- SVM Training
- Data Creation/Generation

**[Input Layer]**
- ↓
**[Detection Layer]**
- ↓
**[Recognition Layer]**
- ↓
**[Output Layer]**

- plate_locate
- plate_judge
- plate_detect
- chars_segment
- chars_identify
- chars_recognise

- ann_train
- svm_train
- create_data

- Model Storage
- Resource Management
- Configuration System

##### Implementation Details

- Rectangles for processing modules
- Clear labels for each component
- Version information (current: 1.6)

##### Additional Notes

- Performance metrics where relevant (80% accuracy rate)
- Integration points with OpenCV
- Where configuration options affect the pipeline

Remember to highlight the system's unique features:
- Chinese character recognition capabilities
- OpenCV integration points
- Multi-platform support
- Training system architecture

This will create a comprehensive yet clear representation of the EasyPR system that can be used for both development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IMG[Input Image]:::input
    end

    subgraph "Detection Layer"
        PL["Plate Location"]:::core
        PJ["Plate Judge"]:::core
        PD["Plate Detect"]:::core
        
        IMG --> PL
        PL --> PJ
        PJ --> PD
    end

    subgraph "Recognition Layer"
        CS["Character Segmentation"]:::core
        CI["Character Identification"]:::core
        CR["Character Recognition"]:::core
        
        PD --> CS
        CS --> CI
        CI --> CR
    end

    subgraph "Training System"
        AT["ANN Training"]:::training
        ST["SVM Training"]:::training
        DC["Data Creation"]:::training
        
        DC --> AT
        DC --> ST
    end

    subgraph "Model Storage"
        AM["ANN Models"]:::storage
        SM["SVM Models"]:::storage
        
        AT --> AM
        ST --> SM
        AM --> CR
        SM --> CR
    end

    subgraph "External Dependencies"
        OCV["OpenCV"]:::external
        LBP["LBP"]:::external
        MSER["MSER"]:::external
        SVM["SVM"]:::external
        TD["Text Detection"]:::external
    end

    subgraph "Utility Services"
        CU["Core Utilities"]:::utility
        CF["Configuration"]:::utility
        PO["Program Options"]:::utility
    end

    %% Component relationships
    OCV --> PL
    OCV --> CS
    LBP --> PL
    MSER --> PL
    SVM --> PJ
    TD --> CS

    %% Click events
    click PL "https://github.com/liuruoze/EasyPR/blob/master/src/core/plate_locate.cpp"
    click PJ "https://github.com/liuruoze/EasyPR/blob/master/src/core/plate_judge.cpp"
    click PD "https://github.com/liuruoze/EasyPR/blob/master/src/core/plate_detect.cpp"
    click CS "https://github.com/liuruoze/EasyPR/blob/master/src/core/chars_segment.cpp"
    click CI "https://github.com/liuruoze/EasyPR/blob/master/src/core/chars_identify.cpp"
    click CR "https://github.com/liuruoze/EasyPR/blob/master/src/core/chars_recognise.cpp"
    click AT "https://github.com/liuruoze/EasyPR/blob/master/src/train/ann_train.cpp"
    click ST "https://github.com/liuruoze/EasyPR/blob/master/src/train/svm_train.cpp"
    click DC "https://github.com/liuruoze/EasyPR/blob/master/src/train/create_data.cpp"
    click AM "https://github.com/liuruoze/EasyPR/blob/master/model/ann.xml"
    click SM "https://github.com/liuruoze/EasyPR/blob/master/model/svm_hist.xml"
    click LBP "https://github.com/liuruoze/EasyPR/tree/master/thirdparty/LBP"
    click MSER "https://github.com/liuruoze/EasyPR/tree/master/thirdparty/mser"
    click SVM "https://github.com/liuruoze/EasyPR/tree/master/thirdparty/svm"
    click TD "https://github.com/liuruoze/EasyPR/tree/master/thirdparty/textDetect"
    click CU "https://github.com/liuruoze/EasyPR/blob/master/src/util/util.cpp"
    click CF "https://github.com/liuruoze/EasyPR/blob/master/include/easypr/config.h"
    click PO "https://github.com/liuruoze/EasyPR/blob/master/src/util/program_options.cpp"

    %% Styling
    classDef core fill:#2374ab
    classDef training fill:#57a773
    classDef utility fill:#ffd151
    classDef external fill:#cccccc
    classDef storage fill:#7d4e57
    classDef input fill:#fff

    %% Legend
    subgraph Legend
        L1["Core Processing"]:::core
        L2["Training Components"]:::training
        L3["Utility Services"]:::utility
        L4["External Dependencies"]:::external
        L5["Storage"]:::storage
    end
```
