# yanqing-shi/heat-haze-reduction architecture

> Architecture diagram of the GitHub repository yanqing-shi/heat-haze-reduction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yanqing-shi/heat-haze-reduction
- Repository: https://github.com/yanqing-shi/heat-haze-reduction

## Overview

Heat Haze is a small interactive OpenCV desktop tool for repairing locally selected heat-haze distortion in a photo. The user opens an image, marks a region by dragging, and releases to trigger edge detection, curve fitting, and pixel smoothing; the edited image is displayed and saved as result.jpg. Zoom, pan, and undo are part of the viewer workflow. The graph separates the repair stages even though they are implemented together in method.cpp. Relationships are limited to those shown in the excerpts or documented in the README.

Main entry points: [`Heat Haze/WindowZoom.cpp`](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/WindowZoom.cpp) (Interactive viewer), [`Heat Haze/main.cpp`](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/main.cpp) (Application entry), [`Heat Haze/method.cpp`](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/method.cpp) (Edge detection), [`Heat Haze/PolyFit.cpp`](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/PolyFit.cpp) (Quadratic fitting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_viewer["Image viewer"]
  node_app["Application entry<br/>[main.cpp]"]
  node_viewer_ui["Interactive viewer<br/>[WindowZoom.cpp]"]
  node_mouse["Mouse controls<br/>[WindowZoom.cpp]"]
end

subgraph group_repair["Repair pipeline"]
  node_edge_detection["Edge detection<br/>[method.cpp]"]
  node_curve_fit["Quadratic fitting<br/>[PolyFit.cpp]"]
  node_pixel_repair["Pixel smoothing<br/>[method.cpp]"]
end

subgraph group_results["Image results"]
  node_edited_image["Edited image"]
end

node_user(("User"))
node_input_image["Source image"]

node_user -->|"starts"| node_app
node_app -->|"creates"| node_viewer_ui
node_app -->|"loads path"| node_input_image
node_user -->|"marks region"| node_viewer_ui
node_viewer_ui -->|"displays"| node_input_image
node_viewer_ui -->|"registers callback"| node_mouse
node_mouse -->|"invokes prep"| node_edge_detection
node_edge_detection -->|"calls Poly"| node_curve_fit
node_edge_detection -->|"passes fit results"| node_pixel_repair
node_pixel_repair -->|"writes result.jpg"| node_edited_image
node_mouse -->|"refreshes image"| node_viewer_ui

click node_app "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/main.cpp"
click node_viewer_ui "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/WindowZoom.cpp"
click node_mouse "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/WindowZoom.cpp"
click node_edge_detection "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/method.cpp"
click node_curve_fit "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/PolyFit.cpp"
click node_pixel_repair "https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/method.cpp"

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_viewer_ui,node_mouse,node_user toneBlue
class node_edge_detection,node_curve_fit,node_pixel_repair toneAmber
class node_edited_image toneMint
class node_input_image toneIndigo
```

## Components

### Image viewer

- [Application entry](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/main.cpp): `Heat Haze/main.cpp`
- [Interactive viewer](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/WindowZoom.cpp): `Heat Haze/WindowZoom.cpp`
- [Mouse controls](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/WindowZoom.cpp): `Heat Haze/WindowZoom.cpp`

### Repair pipeline

- [Edge detection](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/method.cpp): `Heat Haze/method.cpp`
- [Quadratic fitting](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/PolyFit.cpp): `Heat Haze/PolyFit.cpp`
- [Pixel smoothing](https://github.com/yanqing-shi/heat-haze-reduction/blob/main/Heat%20Haze/method.cpp): `Heat Haze/method.cpp`

### Image results

- **Edited image**

### Other components

- **User**
- **Source image**

## Connections

- User → Application entry: starts (evidence: `README.md`)
- Application entry → Interactive viewer: creates (evidence: `Heat Haze/main.cpp`)
- Application entry → Source image: loads path (evidence: `Heat Haze/main.cpp`)
- User → Interactive viewer: marks region (evidence: `README.md`)
- Interactive viewer → Source image: displays (evidence: `Heat Haze/WindowZoom.cpp`)
- Interactive viewer → Mouse controls: registers callback (evidence: `Heat Haze/WindowZoom.cpp`)
- Mouse controls → Edge detection: invokes prep (evidence: `Heat Haze/WindowZoom.cpp`)
- Edge detection → Quadratic fitting: calls Poly (evidence: `Heat Haze/method.cpp`)
- Edge detection → Pixel smoothing: passes fit results (evidence: `Heat Haze/method.cpp`)
- Pixel smoothing → Edited image: writes result.jpg (evidence: `Heat Haze/method.cpp`)
- Mouse controls → Interactive viewer: refreshes image (evidence: `Heat Haze/WindowZoom.cpp`)
