# pratikdhoriyani/virtual-dressing-room architecture

> Architecture diagram of the GitHub repository pratikdhoriyani/virtual-dressing-room, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pratikdhoriyani/virtual-dressing-room
- Repository: https://github.com/pratikdhoriyani/virtual-dressing-room

## Overview

##### Project type and purpose
- This is a full-stack augmented-reality (AR) web application (“Virtual Dressing Room”) that uses a Python web server (Flask), OpenCV-based face/body detectors, and a static e-commerce UI.
- Purpose: capture live camera feed, detect user’s face/body, overlay selected apparel/accessory images in real time, and deliver it through a browser interface.

##### File structure
- Top-level “main.py” (Flask entry point) and supporting scripts: “camera.py”, “tryOn.py”, “tkinter_scroll.py”, “test.py”.
- Project/
- data/ (pretrained Haar cascades, landmark models, custom feature detectors)
- images/ (apparel/accessory image assets used for overlay)
- static/ (CSS, JS, fonts, vendor libs for front-end)
- templates/ (HTML views for website pages: index, product, checkout, etc.)
- Procfile (deployment hint for Heroku or similar)
- README.md (project description and run instructions)

##### README for additional insights
- Confirms Flask-style workflow: run “python main.py” → local host URL → standard browser UI with “TRY NOW” button launching AR overlay.

##### Elements
- Clear labels for: Browser, Flask Server, AR Engine, Data Store, External Libs.
- HTTP requests/responses (Browser ↔ Server)
- Video frame flow (Camera → AR Engine → Browser)
- Asset retrieval (AR Engine → Project/images & data files)
- Back-end components in another (e.g., green)
- Data/models in another (e.g., orange)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Client Browser"]:::frontend
        subgraph "HTML Templates"
            index["index.html"]:::frontend
            product["product.html"]:::frontend
            checkout["checkout.html"]:::frontend
        end
        subgraph "Static Assets"
            css["CSS Files"]:::frontend
            js["JavaScript Files"]:::frontend
            fonts["Font Files"]:::frontend
            images_static["Static Images"]:::frontend
        end
    end

    %% Application Layer
    subgraph "Application Layer"
        Server["Flask Server (main.py)"]:::backend
        Routes["Route Handlers"]:::backend
        UI_Scripts["UI Scripts (tkinter_scroll.py)"]:::backend
        Test["Test Harness (test.py)"]:::backend
    end

    %% AR Processing Engine
    subgraph "AR Processing Engine"
        Camera["Camera Capture (camera.py)"]:::backend
        Detection["Face/Body Detection"]:::backend
        Landmark["Landmark Estimation"]:::backend
        Overlay["Try-On Logic (tryOn.py)"]:::backend
        Compositing["Image Compositing"]:::backend
    end

    %% Data / Asset Store
    subgraph "Data / Asset Store"
        Models["Pretrained Models"]:::data
        Features["Custom Feature Detectors"]:::data
        ImagesStore["Overlay Image Assets"]:::data
    end

    %% External Libraries
    subgraph "External Libraries"
        FlaskLib["Flask"]:::external
        OpenCV["OpenCV (cv2)"]:::external
        dlibLib["dlib"]:::external
        subgraph "Front-end Libraries"
            Bootstrap["Bootstrap CSS"]:::external
            jQueryPlugins["jQuery Plugins & FlexSlider/Magnific Popup"]:::external
            FontAwesome["Font Awesome Icons"]:::external
            Vendor["Additional Vendor Assets"]:::external
        end
    end

    %% Connections
    Browser -->|"loads templates"| index
    Browser --> index
    Browser --> product
    Browser --> checkout
    Browser --> css
    Browser --> js
    Browser --> fonts
    Browser --> images_static
    Browser -->|"HTTP Request"| Server
    Server --> Routes
    Server --> UI_Scripts
    Server --> Test
    Server --> FlaskLib
    Server -->|"serves static"| css
    Server --> js
    Server --> fonts
    Server --> images_static
    Server -->|"triggers AR"| Camera

    Camera --> Detection
    Detection --> Landmark
    Landmark --> Overlay
    Overlay --> Compositing
    Compositing -->|"stream frames"| Browser

    Overlay -->|"fetch image"| ImagesStore
    Detection -->|"use models"| Models
    Detection -->|"use detectors"| Features

    Camera --> OpenCV
    Overlay --> dlibLib

    Browser --> Bootstrap
    Browser --> jQueryPlugins
    Browser --> FontAwesome
    Browser --> Vendor

    %% Click Events
    click index "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/templates/index.html"
    click product "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/templates/product.html"
    click checkout "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/templates/checkout.html"
    click css "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/css/"
    click js "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/js/"
    click fonts "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/fonts/"
    click images_static "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/images/"
    click Server "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/main.py"
    click UI_Scripts "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/tkinter_scroll.py"
    click Test "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/test.py"
    click Camera "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/camera.py"
    click Overlay "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/tryOn.py"
    click Models "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/data/"
    click Features "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/data/FaceFeaturesDetectors/"
    click ImagesStore "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/images/"
    click Bootstrap "https://github.com/pratikdhoriyani/virtual-dressing-room/blob/master/Project/static/css/bootstrap.css"
    click jQueryPlugins "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/js/"
    click FontAwesome "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/fonts/font-awesome-4.7.0/"
    click Vendor "https://github.com/pratikdhoriyani/virtual-dressing-room/tree/master/Project/static/vendor/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFD700,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
