# wellflat/imageprocessing-labs architecture

> Architecture diagram of the GitHub repository wellflat/imageprocessing-labs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wellflat/imageprocessing-labs
- Repository: https://github.com/wellflat/imageprocessing-labs

## Overview

##### Project type and purpose
- This is an open-source collection of front-end and Node.js labs for CV, image processing, drawing and ML.
- There is no central backend or database; each lab is a self-contained demo or utility.

##### File structure
- Top-level folders:
- cv/       → computer vision labs (FFT, LSD, stereo matching, etc.)
- ml/       → machine learning labs (decision tree, GBDT, logistic regression, autoencoder, t-SNE, etc.)
- cv/ort_web → ONNX Runtime for Web integration demo
- images/   → sample images used across demos
- Each subfolder follows one of two patterns:
- Pure JavaScript demos (e.g., cv/fft/*, cv/pixel_clustering/*)
- TypeScript modules compiled via webpack or tsc (e.g., ml/arow, ml/t-sne, cv/lsd)
- Build/config files: .babelrc, tsconfig.json, webpack.config.js, package.json in subpackages.
- Test files under specific modules (e.g., qunit-fft-test.js, Chutzpah JSON).

##### README for additional insights
- Confirms topics and highlights that demos run in browser or Node.
- No single “service” or API; each lab is invoked as HTML + JS or Node script.

a. Main components
- Monorepo Root
- Build & Tooling Layer (TypeScript compiler, Babel, Webpack, ESLint, QUnit/Chutzpah)
- Demo Hosts (Browser via static HTML pages, Node.js CLI scripts)
- External Dependencies (npm packages, ONNX Runtime for Web)
b. Relationships & interactions
- Source code in each module flows into its build pipeline (tsc or webpack) → produces JS bundles.
- Bundles are loaded by demo HTML pages (for browser) or required by Node scripts.
- Tests run against the built code.
- Optional shared utilities under cv/utils and ml/utils are consumed by their respective modules.
c. Architectural patterns & design principles
- Monorepo pattern: colocate related modules, share tooling and dependencies.
- Modular, pluggable demos: each folder is self-contained.
- Pure static-site architecture for browser demos.
- TypeScript → JS transpilation for stronger typing in selected labs.
d. Key technologies, frameworks, libraries
- JavaScript, TypeScript, ES6 modules
- Build tools: webpack, Babel, tsc
- Test frameworks: QUnit, Chutzpah
- Linting: ESLint
- ONNX Runtime for Web

## Diagram (Mermaid)

```mermaid
flowchart TD
    Monorepo["Monorepo Root"]:::root

    subgraph "Computer Vision Modules"
        CV["CV Module Group"]:::module
        CV_UTILS["CV Shared Utilities"]:::util
        FFT["FFT Demo"]:::demo
        LSD["LSD Demo"]:::demo
        POISSON["Poisson Blending Demo"]:::demo
        STEREO["Stereo Matching Demo"]:::demo
        PIXEL["Pixel Clustering Demo"]:::demo
        CORNER["Corner Detection Demo"]:::demo
        FISHEYE["Fisheye Transform Demo"]:::demo
        ORTWEB["ONNX Runtime for Web Demo"]:::demo
    end

    subgraph "Machine Learning Modules"
        ML["ML Module Group"]:::module
        ML_UTILS["ML Shared Utilities"]:::util
        AROW["AROW Module"]:::demo
        AUTOENC["Autoencoder Demo"]:::demo
        TSNE["t-SNE Demo"]:::demo
        GBDT["GBDT Demo"]:::demo
        DTREE["Decision Tree Demo"]:::demo
        KMEANS["K-Means Demo"]:::demo
        LOGREG["Logistic Regression Demo"]:::demo
        SCW["SCW Module"]:::demo
        DATASETS["Datasets Utilities"]:::util
    end

    subgraph "Draw/WebGL Modules"
        DRAW["Draw Module Group"]:::module
        DRAWCORE["Core 3D Draw Samples"]:::demo
        WEBGL["WebGL Browser Demo"]:::demo
    end

    subgraph "Build & Tooling Layer"
        TSC["TypeScript Compiler (tsc)"]:::build
        WEBPACK["Webpack Bundler"]:::build
        BABEL["Babel Transpiler"]:::build
        ESLINT["ESLint Linter"]:::build
    end

    subgraph "Demo Hosts"
        BROWSER["Browser (Static HTML)"]:::host
        NODEJS["Node.js CLI Scripts"]:::host
    end

    IMAGES["Sample Images"]:::asset

    %% Relationships
    Monorepo --> CV
    Monorepo --> ML
    Monorepo --> DRAW
    Monorepo --> IMAGES

    CV_UTILS --> CV
    ML_UTILS --> ML
    DATASETS --> ML

    CV -->|contains| FFT
    CV -->|contains| LSD
    CV -->|contains| POISSON
    CV -->|contains| STEREO
    CV -->|contains| PIXEL
    CV -->|contains| CORNER
    CV -->|contains| FISHEYE
    CV -->|contains| ORTWEB

    ML -->|contains| AROW
    ML -->|contains| AUTOENC
    ML -->|contains| TSNE
    ML -->|contains| GBDT
    ML -->|contains| DTREE
    ML -->|contains| KMEANS
    ML -->|contains| LOGREG
    ML -->|contains| SCW

    DRAW -->|contains| DRAWCORE
    DRAW -->|contains| WEBGL

    %% Build flow
    FFT -->|tsc webpack| TSC
    LSD -->|tsc webpack babel| TSC
    POISSON -->|babel| BABEL
    STEREO -->|babel| BABEL
    PIXEL -->|babel| BABEL
    CORNER -->|babel| BABEL
    FISHEYE -->|babel| BABEL
    ORTWEB -->|npm install| WEBPACK

    AROW -->|tsc| TSC
    AUTOENC -->|webpack| WEBPACK
    TSNE -->|webpack babel| WEBPACK
    GBDT -->|babel| BABEL
    DTREE -->|babel| BABEL
    KMEANS -->|babel| BABEL
    LOGREG -->|babel| BABEL
    SCW -->|tsc| TSC

    DRAWCORE -->|babel| BABEL
    WEBGL -->|webpack| WEBPACK

    TSC -->|output bundles| BROWSER
    WEBPACK -->|bundle output| BROWSER
    BABEL -->|transpiled JS| BROWSER

    TSC -->|cli scripts| NODEJS
    BABEL -->|cli scripts| NODEJS

    AUTOENC -->|tests| AUTOENC_TEST
    FFT -->|tests| FFT_TEST

    IMAGES -->|assets| BROWSER

    %% Click Events
    click Monorepo "https://github.com/wellflat/imageprocessing-labs/tree/main//"
    click CV "https://github.com/wellflat/imageprocessing-labs/tree/main//cv"
    click CV_UTILS "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/utils"
    click FFT "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/fft"
    click FFT_TEST "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/fft/qunit-fft-test.js"
    click LSD "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/lsd"
    click POISSON "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/poisson_blending"
    click STEREO "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/stereo_matching"
    click PIXEL "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/pixel_clustering"
    click CORNER "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/corner_detection"
    click FISHEYE "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/fisheye_transform"
    click ORTWEB "https://github.com/wellflat/imageprocessing-labs/tree/main//cv/ort_web"

    click ML "https://github.com/wellflat/imageprocessing-labs/tree/main//ml"
    click ML_UTILS "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/utils"
    click AROW "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/arow"
    click AUTOENC "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/autoencoder"
    click TSNE "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/t-sne"
    click GBDT "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/gbdt"
    click DTREE "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/decisiontree"
    click KMEANS "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/kmeans"
    click LOGREG "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/logistic_regression"
    click SCW "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/scw"
    click DATASETS "https://github.com/wellflat/imageprocessing-labs/tree/main//ml/datasets"

    click DRAW "https://github.com/wellflat/imageprocessing-labs/tree/main//draw"
    click DRAWCORE "https://github.com/wellflat/imageprocessing-labs/tree/main//draw"
    click WEBGL "https://github.com/wellflat/imageprocessing-labs/blob/main//draw/webgl/webglsample.html"

    click TSC "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/lsd/jsconfig.json"
    click WEBPACK "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/lsd/webpack.config.js"
    click BABEL "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/lsd/.babelrc"
    click ESLINT "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/lsd/.eslintrc.json"

    click AUTOENC_TEST "https://github.com/wellflat/imageprocessing-labs/blob/main//ml/autoencoder/spec/Chutzpah.json"
    click FFT_TEST "https://github.com/wellflat/imageprocessing-labs/blob/main//cv/fft/qunit-fft-test.js"

    click IMAGES "https://github.com/wellflat/imageprocessing-labs/tree/main//images"

    %% Styles
    classDef root fill:#f9f,stroke:#333,stroke-width:2px
    classDef module fill:#bbf,stroke:#333,stroke-width:1px
    classDef util fill:#ddf,stroke:#333,stroke-width:1px
    classDef demo fill:#bfb,stroke:#333,stroke-width:1px
    classDef build fill:#fbf,stroke:#333,stroke-width:1px
    classDef host fill:#ffb,stroke:#333,stroke-width:1px
    classDef asset fill:#ffe,stroke:#333,stroke-width:1px
```
