# khaisaigon/btl_xla_nhom_5_histogram architecture

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

- Interactive diagram: https://gitdiagram.com/khaisaigon/btl_xla_nhom_5_histogram
- Repository: https://github.com/khaisaigon/btl_xla_nhom_5_histogram

## Overview

This is a Streamlit image-processing experiment app for grayscale 8-bit histogram operations. Users upload image(s), choose one of three workflows, inspect transformed images, histograms/CDFs and comparison metrics, and download results. The graph includes the shared algorithm and analysis layers plus the documented Jupyter experiment capability. Source excerpts and the README support the main flow; some module links rely on the supplied SOURCE INDEX, so unsampled details are not inferred.

Main entry points: [`web_modules/histogram_equalization.py`](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_equalization.py) (Equalization page), [`web_modules/adaptive_equalization.py`](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/adaptive_equalization.py) (Adaptive page), [`web_modules/histogram_matching.py`](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_matching.py) (Matching page), [`app.py`](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/app.py) (Streamlit app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_equalization_ui["Equalization page"]
  node_adaptive_ui["Adaptive page"]
  node_matching_ui["Matching page"]
end

subgraph group_prep["Image preparation"]
  node_preprocessing["Image preprocessing<br/>[preprocessing.py]"]
end

subgraph group_algorithms["Histogram algorithms"]
  node_histogram["Histogram functions<br/>[histogram.py]"]
  node_equalization["Histogram equalization<br/>[equalization.py]"]
  node_adaptive["Adaptive equalization"]
  node_matching["Histogram matching"]
end

subgraph group_analysis["Results and evaluation"]
  node_metrics["Image metrics<br/>[metrics.py]"]
  node_visualization["Charts and CDFs<br/>[visualization.py]"]
  node_notebook["Jupyter experiments"]
end

node_user(("User"))

node_user -->|"uploads and selects"| node_app
node_app -->|"dispatches to"| node_equalization_ui
node_app -->|"dispatches to"| node_adaptive_ui
node_app -->|"dispatches to"| node_matching_ui
node_equalization_ui -->|"converts image"| node_preprocessing
node_adaptive_ui -->|"converts image"| node_preprocessing
node_matching_ui -->|"converts images"| node_preprocessing
node_equalization_ui -->|"runs methods"| node_equalization
node_adaptive_ui -->|"runs methods"| node_adaptive
node_matching_ui -->|"runs methods"| node_matching
node_equalization -->|"uses histogram functions"| node_histogram
node_equalization_ui -->|"compares results"| node_metrics
node_adaptive_ui -->|"compares results"| node_metrics
node_matching_ui -->|"evaluates results"| node_metrics
node_equalization_ui -->|"renders results"| node_visualization
node_adaptive_ui -->|"renders results"| node_visualization
node_matching_ui -->|"plots CDFs"| node_visualization
node_visualization -->|"calculates distributions"| node_histogram
node_notebook -->|"reuses algorithms"| node_equalization
node_notebook -->|"reuses algorithms"| node_adaptive
node_notebook -->|"reuses algorithms"| node_matching

click node_app "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/app.py"
click node_equalization_ui "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_equalization.py"
click node_adaptive_ui "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/adaptive_equalization.py"
click node_matching_ui "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_matching.py"
click node_preprocessing "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/preprocessing.py"
click node_histogram "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/histogram.py"
click node_equalization "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/equalization.py"
click node_adaptive "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/adaptive_equalization.py"
click node_matching "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/histogram_matching.py"
click node_metrics "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/metrics.py"
click node_visualization "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/visualization.py"
click node_notebook "https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/Histogram_and_Histogram%20Equalization_Nhom5.ipynb"

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_app,node_equalization_ui,node_adaptive_ui,node_matching_ui,node_user toneBlue
class node_preprocessing toneAmber
class node_histogram,node_equalization,node_adaptive,node_matching toneMint
class node_metrics,node_visualization,node_notebook toneRose
```

## Components

### Web interface

- [Streamlit app](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/app.py): `app.py`
- [Equalization page](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_equalization.py): `web_modules/histogram_equalization.py`
- [Adaptive page](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/adaptive_equalization.py): `web_modules/adaptive_equalization.py`
- [Matching page](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/web_modules/histogram_matching.py): `web_modules/histogram_matching.py`

### Image preparation

- [Image preprocessing](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/preprocessing.py): `src/preprocessing.py`

### Histogram algorithms

- [Histogram functions](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/histogram.py): `src/histogram.py`
- [Histogram equalization](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/equalization.py): `src/equalization.py`
- [Adaptive equalization](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/adaptive_equalization.py): `src/adaptive_equalization.py`
- [Histogram matching](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/histogram_matching.py): `src/histogram_matching.py`

### Results and evaluation

- [Image metrics](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/metrics.py): `src/metrics.py`
- [Charts and CDFs](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/src/visualization.py): `src/visualization.py`
- [Jupyter experiments](https://github.com/khaisaigon/btl_xla_nhom_5_histogram/blob/main/Histogram_and_Histogram%20Equalization_Nhom5.ipynb): `Histogram_and_Histogram Equalization_Nhom5.ipynb`

### Other components

- **User**

## Connections

- User → Streamlit app: uploads and selects (evidence: `README.md`)
- Streamlit app → Equalization page: dispatches to (evidence: `app.py`)
- Streamlit app → Adaptive page: dispatches to (evidence: `app.py`)
- Streamlit app → Matching page: dispatches to (evidence: `app.py`)
- Equalization page → Image preprocessing: converts image (evidence: `web_modules/histogram_equalization.py`)
- Adaptive page → Image preprocessing: converts image (evidence: `web_modules/adaptive_equalization.py`)
- Matching page → Image preprocessing: converts images (evidence: `web_modules/histogram_matching.py`)
- Equalization page → Histogram equalization: runs methods (evidence: `web_modules/histogram_equalization.py`)
- Adaptive page → Adaptive equalization: runs methods (evidence: `web_modules/adaptive_equalization.py`)
- Matching page → Histogram matching: runs methods (evidence: `web_modules/histogram_matching.py`)
- Histogram equalization → Histogram functions: uses histogram functions (evidence: `src/equalization.py`)
- Equalization page → Image metrics: compares results (evidence: `web_modules/histogram_equalization.py`)
- Adaptive page → Image metrics: compares results (evidence: `web_modules/adaptive_equalization.py`)
- Matching page → Image metrics: evaluates results (evidence: `web_modules/histogram_matching.py`)
- Equalization page → Charts and CDFs: renders results (evidence: `web_modules/histogram_equalization.py`)
- Adaptive page → Charts and CDFs: renders results (evidence: `web_modules/adaptive_equalization.py`)
- Matching page → Charts and CDFs: plots CDFs (evidence: `web_modules/histogram_matching.py`)
- Charts and CDFs → Histogram functions: calculates distributions (evidence: `src/visualization.py`)
- Jupyter experiments → Histogram equalization: reuses algorithms (evidence: `README.md`)
- Jupyter experiments → Adaptive equalization: reuses algorithms (evidence: `README.md`)
- Jupyter experiments → Histogram matching: reuses algorithms (evidence: `README.md`)
