# sathishcr777/pcb-image-processing architecture

> Architecture diagram of the GitHub repository sathishcr777/pcb-image-processing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sathishcr777/pcb-image-processing
- Repository: https://github.com/sathishcr777/pcb-image-processing

## Overview

This is an industrial PCB inspection and metrology platform: a camera client submits board images to a FastAPI service, which aligns the image, detects 2D and depth defects, computes quality and measurements, and returns annotated results while recording an audit trail. The README also documents CAD-based ROI ingestion, photometric inspection, solder profiling, X-ray analysis, and IPC-CFX telemetry. The sampled server excerpt does not establish all runtime dispatch paths, so uncertain links to those engines are dashed and uncited.

Main entry points: [`server/main.py`](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/main.py) (REST Service), [`client/capture_and_send.py`](https://github.com/sathishcr777/pcb-image-processing/blob/main/client/capture_and_send.py) (Camera Client), [`server/static/app.js`](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/static/app.js) (Web Dashboard), [`server/pipeline/detector_depth.py`](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/detector_depth.py) (Depth Inspection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Image Capture"]
  node_camera["Camera Client"]
end

subgraph group_service["Inspection Service"]
  node_api["REST Service<br/>[main.py]"]
  node_dashboard["Web Dashboard<br/>[app.js]"]
end

subgraph group_analysis["Inspection Engines"]
  node_alignment["Image Alignment<br/>[aligner.py]"]
  node_detect2d["2D Defect Detection<br/>[detector_2d.py]"]
  node_depth["Depth Inspection<br/>[detector_depth.py]"]
  node_leveler["Substrate Leveling"]
  node_metrology["IPC Metrology"]
  node_cad["CAD ROI Ingestion<br/>[cad_parser.py]"]
  node_photometric["Photometric Stereo"]
  node_solder["Solder Profiling<br/>[solder_profiler.py]"]
  node_xray["X-Ray Inspection<br/>[xray_engine.py]"]
end

subgraph group_quality["Quality &amp; Traceability"]
  node_health["Health &amp; Verdict<br/>[health_index.py]"]
  node_visualizer["Result Visualization<br/>[visualizer.py]"]
  node_cfx["CFX Telemetry<br/>[cfx_dispatcher.py]"]
  node_audit[("Audit Log<br/>[logger.py]")]
end

node_operator(("Line Operator"))

node_operator -->|"captures board"| node_camera
node_camera -->|"submits image"| node_api
node_operator -.->|"views results"| node_dashboard
node_dashboard -.->|"requests API"| node_api
node_api -.->|"aligns image"| node_alignment
node_api -.->|"detects defects"| node_detect2d
node_api -.->|"checks depth"| node_depth
node_depth -->|"levels depth"| node_leveler
node_api -->|"measures components"| node_metrology
node_api -.->|"imports centroids"| node_cad
node_api -.->|"runs stereo"| node_photometric
node_api -.->|"profiles solder"| node_solder
node_api -.->|"inspects X-ray"| node_xray
node_api -->|"computes verdict"| node_health
node_api -->|"renders overlay"| node_visualizer
node_api -->|"writes record"| node_audit
node_api -.->|"dispatches events"| node_cfx

click node_camera "https://github.com/sathishcr777/pcb-image-processing/blob/main/client/capture_and_send.py"
click node_api "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/main.py"
click node_dashboard "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/static/app.js"
click node_alignment "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/aligner.py"
click node_detect2d "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/detector_2d.py"
click node_depth "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/detector_depth.py"
click node_leveler "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/substrate_leveler.py"
click node_metrology "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/metrology_engine.py"
click node_cad "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/cad_parser.py"
click node_photometric "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/photometric_stereo.py"
click node_solder "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/solder_profiler.py"
click node_xray "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/xray_engine.py"
click node_health "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/health_index.py"
click node_visualizer "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/visualizer.py"
click node_cfx "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/cfx_dispatcher.py"
click node_audit "https://github.com/sathishcr777/pcb-image-processing/blob/main/server/audit/logger.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_camera toneBlue
class node_api,node_dashboard toneAmber
class node_alignment,node_detect2d,node_depth,node_leveler,node_metrology,node_cad,node_photometric,node_solder,node_xray toneMint
class node_health,node_visualizer,node_cfx,node_audit toneRose
class node_operator toneIndigo
```

## Components

### Image Capture

- [Camera Client](https://github.com/sathishcr777/pcb-image-processing/blob/main/client/capture_and_send.py): `client/capture_and_send.py`

### Inspection Service

- [REST Service](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/main.py): `server/main.py`
- [Web Dashboard](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/static/app.js): `server/static/app.js`

### Inspection Engines

- [Image Alignment](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/aligner.py): `server/pipeline/aligner.py`
- [2D Defect Detection](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/detector_2d.py): `server/pipeline/detector_2d.py`
- [Depth Inspection](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/detector_depth.py): `server/pipeline/detector_depth.py`
- [Substrate Leveling](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/substrate_leveler.py): `server/pipeline/substrate_leveler.py`
- [IPC Metrology](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/metrology_engine.py): `server/pipeline/metrology_engine.py`
- [CAD ROI Ingestion](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/cad_parser.py): `server/pipeline/cad_parser.py`
- [Photometric Stereo](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/photometric_stereo.py): `server/pipeline/photometric_stereo.py`
- [Solder Profiling](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/solder_profiler.py): `server/pipeline/solder_profiler.py`
- [X-Ray Inspection](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/xray_engine.py): `server/pipeline/xray_engine.py`

### Quality & Traceability

- [Health & Verdict](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/health_index.py): `server/pipeline/health_index.py`
- [Result Visualization](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/visualizer.py): `server/pipeline/visualizer.py`
- [CFX Telemetry](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/pipeline/cfx_dispatcher.py): `server/pipeline/cfx_dispatcher.py`
- [Audit Log](https://github.com/sathishcr777/pcb-image-processing/blob/main/server/audit/logger.py): `server/audit/logger.py`

### Other components

- **Line Operator**

## Connections

- Line Operator → Camera Client: captures board
- Camera Client → REST Service: submits image
- Line Operator → Web Dashboard: views results
- Web Dashboard → REST Service: requests API
- REST Service → Image Alignment: aligns image (evidence: `server/main.py`)
- REST Service → 2D Defect Detection: detects defects (evidence: `server/main.py`)
- REST Service → Depth Inspection: checks depth (evidence: `server/main.py`)
- Depth Inspection → Substrate Leveling: levels depth (evidence: `server/pipeline/detector_depth.py`)
- REST Service → IPC Metrology: measures components (evidence: `server/main.py`)
- REST Service → CAD ROI Ingestion: imports centroids (evidence: `server/main.py`)
- REST Service → Photometric Stereo: runs stereo (evidence: `server/main.py`)
- REST Service → Solder Profiling: profiles solder (evidence: `server/main.py`)
- REST Service → X-Ray Inspection: inspects X-ray (evidence: `server/main.py`)
- REST Service → Health & Verdict: computes verdict (evidence: `server/main.py`)
- REST Service → Result Visualization: renders overlay (evidence: `server/main.py`)
- REST Service → Audit Log: writes record (evidence: `server/main.py`)
- REST Service → CFX Telemetry: dispatches events (evidence: `server/main.py`)
