# spipm/depixelization_poc architecture

> Architecture diagram of the GitHub repository spipm/depixelization_poc, 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/spipm/depixelization_poc
- Repository: https://github.com/spipm/depixelization_poc

## Overview

Depix is a command-line proof of concept for recovering pixelated text regions by matching their colored blocks against a reference search image, then writing a reconstructed image. Its main workflow loads both images, detects and filters blocks, searches for matches, resolves ambiguous matches geometrically, and saves the result. The repository also includes a pixelation generator and a box-visualization tool. The README only notes that the project migrated; workflow details here come from the sampled source, and unsampled implementation details are not inferred.

Main entry points: [`depix.py`](https://github.com/spipm/depixelization_poc/blob/main/depix.py) (Recovery CLI), [`tool_show_boxes.py`](https://github.com/spipm/depixelization_poc/blob/main/tool_show_boxes.py) (Box visualization), [`depixlib/LoadedImage.py`](https://github.com/spipm/depixelization_poc/blob/main/depixlib/LoadedImage.py) (Image loader), [`tool_gen_pixelated.py`](https://github.com/spipm/depixelization_poc/blob/main/tool_gen_pixelated.py) (Pixelation generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command-line tools"]
  node_recovery_cli["Recovery CLI<br/>[depix.py]"]
  node_box_tool["Box visualization<br/>[tool_show_boxes.py]"]
  node_pixelation_tool["Pixelation generator"]
end

subgraph group_image["Image handling"]
  node_image_loader["Image loader<br/>[LoadedImage.py]"]
  node_pixelation["Block averaging"]
  node_box_renderer["Box renderer<br/>[tool_show_boxes.py]"]
end

subgraph group_recovery["Recovery pipeline"]
  node_block_detection["Block detection<br/>[functions.py]"]
  node_block_filter["Block filtering<br/>[functions.py]"]
  node_match_search["Reference matching<br/>[functions.py]"]
  node_ambiguity_resolution["Match resolution<br/>[functions.py]"]
  node_image_reconstruction["Image reconstruction<br/>[functions.py]"]
end

subgraph group_model["Image data model"]
  node_rectangle_types["Rectangle models<br/>[Rectangle.py]"]
  node_cli_validation["Input validation<br/>[helpers.py]"]
end

node_user(("User"))
node_input_images["Image files"]
node_output_image["Output image"]

node_user -->|"runs"| node_recovery_cli
node_user -->|"runs"| node_box_tool
node_user -->|"runs"| node_pixelation_tool
node_recovery_cli -->|"validates inputs"| node_cli_validation
node_box_tool -->|"validates inputs"| node_cli_validation
node_recovery_cli -->|"loads images"| node_image_loader
node_box_tool -->|"loads images"| node_image_loader
node_pixelation_tool -->|"loads image"| node_image_loader
node_input_images -.->|"read by"| node_image_loader
node_recovery_cli -->|"detects blocks"| node_block_detection
node_recovery_cli -->|"filters blocks"| node_block_filter
node_recovery_cli -->|"searches matches"| node_match_search
node_recovery_cli -->|"resolves matches"| node_ambiguity_resolution
node_recovery_cli -->|"writes matches"| node_image_reconstruction
node_box_tool -->|"detects blocks"| node_block_detection
node_box_tool -->|"filters blocks"| node_block_filter
node_box_tool -->|"draws boxes"| node_box_renderer
node_pixelation_tool -->|"averages blocks"| node_pixelation
node_pixelation_tool -->|"saves image"| node_output_image
node_image_reconstruction -->|"writes pixels"| node_output_image
node_block_detection -->|"uses rectangles"| node_rectangle_types
node_match_search -->|"uses matches"| node_rectangle_types
node_image_loader -->|"opens image"| node_input_images

click node_recovery_cli "https://github.com/spipm/depixelization_poc/blob/main/depix.py"
click node_box_tool "https://github.com/spipm/depixelization_poc/blob/main/tool_show_boxes.py"
click node_pixelation_tool "https://github.com/spipm/depixelization_poc/blob/main/tool_gen_pixelated.py"
click node_image_loader "https://github.com/spipm/depixelization_poc/blob/main/depixlib/LoadedImage.py"
click node_pixelation "https://github.com/spipm/depixelization_poc/blob/main/tool_gen_pixelated.py"
click node_box_renderer "https://github.com/spipm/depixelization_poc/blob/main/tool_show_boxes.py"
click node_block_detection "https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py"
click node_block_filter "https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py"
click node_match_search "https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py"
click node_ambiguity_resolution "https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py"
click node_image_reconstruction "https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py"
click node_rectangle_types "https://github.com/spipm/depixelization_poc/blob/main/depixlib/Rectangle.py"
click node_cli_validation "https://github.com/spipm/depixelization_poc/blob/main/depixlib/helpers.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_recovery_cli,node_box_tool,node_pixelation_tool,node_user toneBlue
class node_image_loader,node_pixelation,node_box_renderer toneAmber
class node_block_detection,node_block_filter,node_match_search,node_ambiguity_resolution,node_image_reconstruction toneMint
class node_rectangle_types,node_cli_validation toneRose
class node_input_images,node_output_image toneIndigo
```

## Components

### Command-line tools

- [Recovery CLI](https://github.com/spipm/depixelization_poc/blob/main/depix.py): `depix.py`
- [Box visualization](https://github.com/spipm/depixelization_poc/blob/main/tool_show_boxes.py): `tool_show_boxes.py`
- [Pixelation generator](https://github.com/spipm/depixelization_poc/blob/main/tool_gen_pixelated.py): `tool_gen_pixelated.py`

### Image handling

- [Image loader](https://github.com/spipm/depixelization_poc/blob/main/depixlib/LoadedImage.py): `depixlib/LoadedImage.py`
- [Block averaging](https://github.com/spipm/depixelization_poc/blob/main/tool_gen_pixelated.py): `tool_gen_pixelated.py`
- [Box renderer](https://github.com/spipm/depixelization_poc/blob/main/tool_show_boxes.py): `tool_show_boxes.py`

### Recovery pipeline

- [Block detection](https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py): `depixlib/functions.py`
- [Block filtering](https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py): `depixlib/functions.py`
- [Reference matching](https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py): `depixlib/functions.py`
- [Match resolution](https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py): `depixlib/functions.py`
- [Image reconstruction](https://github.com/spipm/depixelization_poc/blob/main/depixlib/functions.py): `depixlib/functions.py`

### Image data model

- [Rectangle models](https://github.com/spipm/depixelization_poc/blob/main/depixlib/Rectangle.py): `depixlib/Rectangle.py`
- [Input validation](https://github.com/spipm/depixelization_poc/blob/main/depixlib/helpers.py): `depixlib/helpers.py`

### Other components

- **User**
- **Image files**
- **Output image**

## Connections

- User → Recovery CLI: runs (evidence: `depix.py`)
- User → Box visualization: runs (evidence: `tool_show_boxes.py`)
- User → Pixelation generator: runs (evidence: `tool_gen_pixelated.py`)
- Recovery CLI → Input validation: validates inputs (evidence: `depix.py`)
- Box visualization → Input validation: validates inputs (evidence: `tool_show_boxes.py`)
- Recovery CLI → Image loader: loads images (evidence: `depix.py`)
- Box visualization → Image loader: loads images (evidence: `tool_show_boxes.py`)
- Pixelation generator → Image loader: loads image (evidence: `tool_gen_pixelated.py`)
- Image files → Image loader: read by
- Recovery CLI → Block detection: detects blocks (evidence: `depix.py`)
- Recovery CLI → Block filtering: filters blocks (evidence: `depix.py`)
- Recovery CLI → Reference matching: searches matches (evidence: `depix.py`)
- Recovery CLI → Match resolution: resolves matches (evidence: `depix.py`)
- Recovery CLI → Image reconstruction: writes matches (evidence: `depix.py`)
- Box visualization → Block detection: detects blocks (evidence: `tool_show_boxes.py`)
- Box visualization → Block filtering: filters blocks (evidence: `tool_show_boxes.py`)
- Box visualization → Box renderer: draws boxes (evidence: `tool_show_boxes.py`)
- Pixelation generator → Block averaging: averages blocks (evidence: `tool_gen_pixelated.py`)
- Pixelation generator → Output image: saves image (evidence: `tool_gen_pixelated.py`)
- Image reconstruction → Output image: writes pixels
- Block detection → Rectangle models: uses rectangles (evidence: `depixlib/functions.py`)
- Reference matching → Rectangle models: uses matches (evidence: `depixlib/functions.py`)
- Image loader → Image files: opens image (evidence: `depixlib/LoadedImage.py`)
