# levidpc/visualprivacyapp01 architecture

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

- Interactive diagram: https://gitdiagram.com/levidpc/visualprivacyapp01
- Repository: https://github.com/levidpc/visualprivacyapp01

## Overview

#### Purpose and Entry Points
This is a browser-based “Visual Privacy App” draft that appears to process images and apply privacy-oriented edits, likely centered on face detection and redaction. The primary application entry point is `index.html`, with browser initialization and orchestration in `JS/main.js`. `test.html` and `JS/test.js` provide a separate experimentation/test surface.

#### Browser Application Shell
The UI is defined by `index.html` and styled through `mystyle.css`. JavaScript is loaded directly into the browser rather than through a build system or server runtime. The application operates on local/static assets and user-selected or repository images.

Grounding:
- `index.html`
- `mystyle.css`
- `JS/main.js`

#### Main Control and Image Workflow
`JS/main.js` is the likely coordinator for image loading, invoking computer-vision operations, and updating the displayed result. The expected control flow is: select/load source image → pass image data to OpenCV/detection logic → apply selected privacy edits → render or export the result.

Grounding:
- `JS/main.js`
- `JS/utils.js`
- `images/result`

#### Computer Vision / Face Detection Boundary
The repository includes OpenCV browser bindings and a Haar/LBP cascade classifier for frontal-face detection. This forms the key external-compute boundary: application code calls OpenCV APIs, which consume image/canvas data and use `lbpcascade_frontalface.xml` as the detector model.

Grounding:
- `JS/opencv.js`
- `lbpcascade_frontalface.xml`
- `JS/main.js`

#### Privacy Editing Layer
`JS/editTools.js` likely contains the transformation operations applied after detection or manual selection, such as obscuring, masking, cropping, or similar image edits. It should remain distinct from detection: detection produces regions; edit tools consume those regions and mutate/render image pixels.

Grounding:
- `JS/editTools.js`
- `JS/main.js`
- `JS/utils.js`

#### Assets and Output Data
Image folders provide source material, curated/downscaled image sets, and generated results. They represent file-based inputs and outputs rather than a database or external object store. `images/doppleganger_notes.txt` may document image matching/doppelganger-related experimentation.

Grounding:
- `images/Source`
- `images/cherry_picked_pics`
- `images/result`

#### Runtime and Infrastructure
Runtime is a static HTML/CSS/JavaScript browser application. Its material dependency is client-side OpenCV delivered in `JS/opencv.js`; no backend service, package manifest, database, deployment configuration, or API integration is present in the supplied tree. Face classification depends on the local cascade XML asset being available to browser-side code.

Grounding:
- `index.html`
- `JS/opencv.js`
- `lbpcascade_frontalface.xml>

Main entry points: [`JS/main.js`](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/main.js) (Workflow controller), [`JS/editTools.js`](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/editTools.js) (Privacy edit tools), [`index.html`](https://github.com/levidpc/visualprivacyapp01/blob/main/index.html) (App page), [`images/Source`](https://github.com/levidpc/visualprivacyapp01/tree/main/images/Source) (Source images)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser App"]
  node_html["App page<br/>HTML entry<br/>[index.html]"]
  node_styles["App styles<br/>CSS<br/>[mystyle.css]"]
  node_main["Workflow controller<br/>browser JavaScript<br/>[main.js]"]
  node_utils["Image utilities<br/>browser JavaScript<br/>[utils.js]"]
end

subgraph group_vision["Vision &amp; Editing"]
  node_opencv{{"OpenCV bindings<br/>client-side CV runtime<br/>[opencv.js]"}}
  node_cascade["Face cascade model<br/>LBP classifier"]
  node_detection["Face detection<br/>vision operation"]
  node_edits["Privacy edit tools<br/>image transformations<br/>[editTools.js]"]
end

subgraph group_assets["Image Assets"]
  node_source[("Source images<br/>file input set")]
  node_curated[("Curated images<br/>file input set")]
  node_results[("Result images<br/>file output set")]
end

subgraph group_test["Experiment Surface"]
  node_testhtml["Test page<br/>HTML entry<br/>[test.html]"]
  node_testjs["Test script<br/>browser JavaScript<br/>[test.js]"]
end

node_html -->|"loads"| node_styles
node_html -->|"loads"| node_main
node_main -->|"uses"| node_utils
node_main -->|"requests face regions"| node_detection
node_detection -->|"runs with"| node_opencv
node_detection -->|"loads model"| node_cascade
node_main -->|"applies selected edits"| node_edits
node_source -->|"image input"| node_main
node_curated -->|"image input"| node_main
node_detection -->|"detected regions"| node_edits
node_edits -->|"renders or exports"| node_results
node_testhtml -->|"loads"| node_testjs

click node_html "https://github.com/levidpc/visualprivacyapp01/blob/main/index.html"
click node_styles "https://github.com/levidpc/visualprivacyapp01/blob/main/mystyle.css"
click node_main "https://github.com/levidpc/visualprivacyapp01/blob/main/JS/main.js"
click node_utils "https://github.com/levidpc/visualprivacyapp01/blob/main/JS/utils.js"
click node_opencv "https://github.com/levidpc/visualprivacyapp01/blob/main/JS/opencv.js"
click node_cascade "https://github.com/levidpc/visualprivacyapp01/blob/main/lbpcascade_frontalface.xml"
click node_edits "https://github.com/levidpc/visualprivacyapp01/blob/main/JS/editTools.js"
click node_source "https://github.com/levidpc/visualprivacyapp01/tree/main/images/Source"
click node_curated "https://github.com/levidpc/visualprivacyapp01/tree/main/images/cherry_picked_pics"
click node_results "https://github.com/levidpc/visualprivacyapp01/tree/main/images/result"
click node_testhtml "https://github.com/levidpc/visualprivacyapp01/blob/main/test.html"
click node_testjs "https://github.com/levidpc/visualprivacyapp01/blob/main/JS/test.js"

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_html,node_styles,node_main,node_utils toneBlue
class node_opencv,node_cascade,node_detection,node_edits toneAmber
class node_source,node_curated,node_results toneMint
class node_testhtml,node_testjs toneRose
```

## Components

### Browser App

- [App page](https://github.com/levidpc/visualprivacyapp01/blob/main/index.html): HTML entry · Static browser entry point. · `index.html`
- [App styles](https://github.com/levidpc/visualprivacyapp01/blob/main/mystyle.css): CSS · `mystyle.css`
- [Workflow controller](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/main.js): browser JavaScript · Coordinates loading, detection, privacy edits, and display. · `JS/main.js`
- [Image utilities](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/utils.js): browser JavaScript · `JS/utils.js`

### Vision & Editing

- [OpenCV bindings](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/opencv.js): client-side CV runtime · Browser-delivered computer-vision dependency. · `JS/opencv.js`
- [Face cascade model](https://github.com/levidpc/visualprivacyapp01/blob/main/lbpcascade_frontalface.xml): LBP classifier · Local frontal-face detection model. · `lbpcascade_frontalface.xml`
- **Face detection**: vision operation · Finds face regions from image or canvas data.
- [Privacy edit tools](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/editTools.js): image transformations · Applies redaction or other pixel-level edits to selected regions. · `JS/editTools.js`

### Image Assets

- [Source images](https://github.com/levidpc/visualprivacyapp01/tree/main/images/Source): file input set · `images/Source`
- [Curated images](https://github.com/levidpc/visualprivacyapp01/tree/main/images/cherry_picked_pics): file input set · `images/cherry_picked_pics`
- [Result images](https://github.com/levidpc/visualprivacyapp01/tree/main/images/result): file output set · Stores generated image results. · `images/result`

### Experiment Surface

- [Test page](https://github.com/levidpc/visualprivacyapp01/blob/main/test.html): HTML entry · Separate browser experimentation surface. · `test.html`
- [Test script](https://github.com/levidpc/visualprivacyapp01/blob/main/JS/test.js): browser JavaScript · `JS/test.js`

## Connections

- App page → App styles: loads
- App page → Workflow controller: loads
- Workflow controller → Image utilities: uses
- Workflow controller → Face detection: requests face regions
- Face detection → OpenCV bindings: runs with
- Face detection → Face cascade model: loads model
- Workflow controller → Privacy edit tools: applies selected edits
- Source images → Workflow controller: image input
- Curated images → Workflow controller: image input
- Face detection → Privacy edit tools: detected regions
- Privacy edit tools → Result images: renders or exports
- Test page → Test script: loads
