# arbom/tablice architecture

> Architecture diagram of the GitHub repository arbom/tablice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arbom/tablice
- Repository: https://github.com/arbom/tablice

## Overview

1. **Repository shape**
   - This is a **single-process C# console application** (`Tablice`) built on **.NET Framework 4.7.2**.
   - The system is not split into services or tiers; instead, it is a **local image-processing pipeline** that runs end-to-end inside one executable.

2. **Primary runtime boundary**
   - The app consumes a **graphic file from the local filesystem** and produces a recognized registration number.
   - There are no web endpoints, databases, message queues, or cloud dependencies visible in the tree.

3. **Top-level orchestration**
   - `Program.cs` is the execution entrypoint and likely coordinates the full recognition flow.
   - It wires together detection, rectification, character extraction, and classification into one sequential pass.

4. **Core external dependency**
   - The key library is **EmguCV 4.4.0**, which is the .NET wrapper around OpenCV.
   - That means the architecture is centered on classic computer-vision operations: masking, contour analysis, connected components, perspective correction, and image segmentation.

5. **Plate detection subsystem**
   - The first stage finds the plate region in the source image.
   - According to the README, this uses **blue and white masks**, merges candidate regions, then searches for the **largest connected area** and its **corners**.
   - The corner-finding logic appears decomposed into separate helpers: `Helper LeftUpCorner.cs`, `Helper RightUpCorner.cs`, `Helper LeftDownCorner.cs`, `Helper RightDownCorner.cs`.

6. **Plate rectification subsystem**
   - Once the corners are found, the detected plate is isolated and **reshaped/perspective-corrected** into a normalized plate image.
   - `Plate.cs` is likely the domain object for this stage, representing the extracted plate region and its transformed form.
   - This stage is important because it converts a skewed real-world image into a canonical input for character reading.

7. **Character segmentation subsystem**
   - After rectification, the app identifies individual character contours on the plate.
   - `Mark.cs` likely represents one detected sign/character candidate, including its bounding area and features used for recognition.
   - The output of this stage is a sequence of character regions, each isolated for classification.

8. **Classification subsystem**
   - The final recognition step uses an **SVM-based classifier**.
   - The `Data/SVM.txt` and `Data/SVM.xml` files look like persisted model/data artifacts used by the classifier at runtime.
   - The classifier assigns labels to each segmented character, then the app concatenates them into the final plate number.

9. **Supporting image-processing utilities**
   - `Helper.cs` is the shared utility layer for reusable CV operations.
   - It likely contains common functions for thresholding, contour handling, coordinate math, and image conversion, while the four corner-specific helper files isolate directional logic.

10. **Project assets and configuration**
   - `App.config` and `packages.config` support the .NET app/runtime package setup.
   - `Resources.*` suggests bundled application resources, while `Data/` holds model artifacts needed to run recognition locally.
   - This makes the project self-contained: code plus trained recognition data live together in the same repository.

11. **End-to-end data flow**
   - The flow is: **input image → masking/region detection → corner detection → plate normalization → character contour extraction → SVM classification → assembled plate string**.
   - For an architecture diagram, the main boundaries to show are:
     - image input,
     - plate localization,
     - geometric correction,
     - glyph segmentation,
     - SVM inference,
     - final string output.

12. **Implementation style**
   - The architecture is **algorithm-centric**, not framework-centric.
   - Most complexity is in the vision pipeline and geometric reasoning, with a thin console shell around it.

Main entry points: [`Tablice/cs/Plate.cs`](https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs) (Plate Find), [`Tablice/Program.cs`](https://github.com/arbom/tablice/blob/main/Tablice/Program.cs) (Program), [`Tablice/Data/SVM.xml`](https://github.com/arbom/tablice/blob/main/Tablice/Data/SVM.xml) (SVM), [`Tablice/cs/Helper LeftUpCorner.cs`](https://github.com/arbom/tablice/blob/HEAD/Tablice/cs/Helper%20LeftUpCorner.cs) (Left Up)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_runtime["Runtime"]
  node_n_program["Program<br/>entrypoint<br/>[Program.cs]"]
  node_n_output(("Plate Text<br/>result"))
end

subgraph group_grp_pipeline["Vision pipeline"]
  node_n_leftup["Left Up<br/>corner helper"]
  node_n_rightup["Right Up<br/>corner helper"]
  node_n_leftdown["Left Down<br/>corner helper"]
  node_n_rightdown["Right Down<br/>corner helper"]
  node_n_plate_find["Plate Find<br/>localization<br/>[Plate.cs]"]
  node_n_plate_corner{{"Plate Corners<br/>geometry<br/>[Plate.cs]"}}
  node_n_plate_warp["Plate Warp<br/>rectification<br/>[Plate.cs]"]
  node_n_mark["Mark<br/>glyph model<br/>[Mark.cs]"]
  node_n_segment["Segment<br/>contours<br/>[Mark.cs]"]
  node_n_features["Features<br/>descriptors<br/>[Mark.cs]"]
end

subgraph group_grp_support["Support"]
  node_n_helper["Helper<br/>cv utilities<br/>[Helper.cs]"]
  node_n_svm[("SVM<br/>classifier<br/>[SVM.xml]")]
  node_n_svm_data["SVM Data<br/>model artifact<br/>[SVM.txt]"]
  node_n_resources["Resources<br/>embedded assets<br/>[Resources.resx]"]
end

node_n_program -->|"starts"| node_n_plate_find
node_n_program -->|"uses"| node_n_helper
node_n_plate_find -->|"corner hint"| node_n_leftup
node_n_plate_find -->|"corner hint"| node_n_rightup
node_n_plate_find -->|"corner hint"| node_n_leftdown
node_n_plate_find -->|"corner hint"| node_n_rightdown
node_n_leftup -->|"feeds"| node_n_plate_corner
node_n_rightup -->|"feeds"| node_n_plate_corner
node_n_leftdown -->|"feeds"| node_n_plate_corner
node_n_rightdown -->|"feeds"| node_n_plate_corner
node_n_plate_corner -->|"normalizes"| node_n_plate_warp
node_n_plate_warp -->|"produces"| node_n_segment
node_n_segment -->|"creates"| node_n_mark
node_n_mark -->|"describes"| node_n_features
node_n_features -->|"classified by"| node_n_svm
node_n_svm -->|"loads"| node_n_svm_data
node_n_plate_find -.->|"may use"| node_n_resources
node_n_svm -->|"assembles"| node_n_output
node_n_program -->|"returns"| node_n_output

click node_n_program "https://github.com/arbom/tablice/blob/main/Tablice/Program.cs"
click node_n_helper "https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper.cs"
click node_n_leftup "https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper LeftUpCorner.cs"
click node_n_rightup "https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper RightUpCorner.cs"
click node_n_leftdown "https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper LeftDownCorner.cs"
click node_n_rightdown "https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper RightDownCorner.cs"
click node_n_plate_find "https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs"
click node_n_plate_corner "https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs"
click node_n_plate_warp "https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs"
click node_n_mark "https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs"
click node_n_segment "https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs"
click node_n_features "https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs"
click node_n_svm "https://github.com/arbom/tablice/blob/main/Tablice/Data/SVM.xml"
click node_n_svm_data "https://github.com/arbom/tablice/blob/main/Tablice/Data/SVM.txt"
click node_n_resources "https://github.com/arbom/tablice/blob/main/Tablice/Properties/Resources.resx"

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_n_program,node_n_output toneBlue
class node_n_leftup,node_n_rightup,node_n_leftdown,node_n_rightdown,node_n_plate_find,node_n_plate_corner,node_n_plate_warp,node_n_mark,node_n_segment,node_n_features toneAmber
class node_n_helper,node_n_svm,node_n_svm_data,node_n_resources toneMint
```

## Components

### Runtime

Console entrypoint and application shell

- [Program](https://github.com/arbom/tablice/blob/main/Tablice/Program.cs): entrypoint · Console application entrypoint that orchestrates the recognition flow · `Tablice/Program.cs`
- **Plate Text**: result · Final recognized registration number assembled from classified characters

### Vision pipeline

Plate recognition stages from image input to output

- [Left Up](https://github.com/arbom/tablice/blob/HEAD/Tablice/cs/Helper%20LeftUpCorner.cs): corner helper · Helper for detecting the top-left plate corner · `Tablice/cs/Helper LeftUpCorner.cs`
- [Right Up](https://github.com/arbom/tablice/blob/HEAD/Tablice/cs/Helper%20RightUpCorner.cs): corner helper · Helper for detecting the top-right plate corner · `Tablice/cs/Helper RightUpCorner.cs`
- [Left Down](https://github.com/arbom/tablice/blob/HEAD/Tablice/cs/Helper%20LeftDownCorner.cs): corner helper · Helper for detecting the bottom-left plate corner · `Tablice/cs/Helper LeftDownCorner.cs`
- [Right Down](https://github.com/arbom/tablice/blob/HEAD/Tablice/cs/Helper%20RightDownCorner.cs): corner helper · Helper for detecting the bottom-right plate corner · `Tablice/cs/Helper RightDownCorner.cs`
- [Plate Find](https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs): localization · Locates candidate plate regions using masking and connected-area analysis · `Tablice/cs/Plate.cs`
- [Plate Corners](https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs): geometry · Combines corner detection results into a plate quadrilateral · `Tablice/cs/Plate.cs`
- [Plate Warp](https://github.com/arbom/tablice/blob/main/Tablice/cs/Plate.cs): rectification · Perspective-corrects the detected plate into a normalized image · `Tablice/cs/Plate.cs`
- [Mark](https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs): glyph model · Represents a detected character or sign candidate with its features · `Tablice/cs/Mark.cs`
- [Segment](https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs): contours · Extracts and orders character regions from the rectified plate image · `Tablice/cs/Mark.cs`
- [Features](https://github.com/arbom/tablice/blob/main/Tablice/cs/Mark.cs): descriptors · Builds recognition features from segmented character candidates · `Tablice/cs/Mark.cs`

### Support

Shared helpers, resources, and packaged model data

- [Helper](https://github.com/arbom/tablice/blob/main/Tablice/cs/Helper.cs): cv utilities · Shared image-processing and geometry utilities used across stages · `Tablice/cs/Helper.cs`
- [SVM](https://github.com/arbom/tablice/blob/main/Tablice/Data/SVM.xml): classifier · Classifies character features using the persisted SVM model · `Tablice/Data/SVM.xml`
- [SVM Data](https://github.com/arbom/tablice/blob/main/Tablice/Data/SVM.txt): model artifact · Serialized SVM training or metadata data consumed by the classifier · `Tablice/Data/SVM.txt`
- [Resources](https://github.com/arbom/tablice/blob/main/Tablice/Properties/Resources.resx): embedded assets · Application resources bundled with the console app · `Tablice/Properties/Resources.resx`

## Connections

- Program → Plate Find: starts · Entry point launches the recognition pipeline
- Program → Helper: uses · Coordinates shared CV helpers during processing
- Plate Find → Left Up: corner hint · Uses directional helper for the top-left corner
- Plate Find → Right Up: corner hint · Uses directional helper for the top-right corner
- Plate Find → Left Down: corner hint · Uses directional helper for the bottom-left corner
- Plate Find → Right Down: corner hint · Uses directional helper for the bottom-right corner
- Left Up → Plate Corners: feeds · Supplies one detected corner
- Right Up → Plate Corners: feeds · Supplies one detected corner
- Left Down → Plate Corners: feeds · Supplies one detected corner
- Right Down → Plate Corners: feeds · Supplies one detected corner
- Plate Corners → Plate Warp: normalizes · Defines the plate quadrilateral for perspective correction
- Plate Warp → Segment: produces · Provides a normalized plate image for segmentation
- Segment → Mark: creates · Wraps detected character regions as mark objects
- Mark → Features: describes · Transforms each candidate into classifier-ready features
- Features → SVM: classified by · SVM assigns a label to each feature vector
- SVM → SVM Data: loads · Uses persisted model data at runtime
- Plate Find → Resources: may use · May rely on bundled resources for processing or display
- SVM → Plate Text: assembles · Predicted character labels are concatenated into the final plate string
- Program → Plate Text: returns · Console app prints or emits the recognized result
