# jayanths9/virtual_makeup architecture

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

- Interactive diagram: https://gitdiagram.com/jayanths9/virtual_makeup
- Repository: https://github.com/jayanths9/virtual_makeup

## Overview

##### Project Type and Purpose
- This is a single‐process, Python‐based computer vision pipeline (not a web or microservice architecture).

##### File Structure
- Top‐level scripts:
- camera.py – entry point for live video input
- image.py – entry point for static image processing
- Utilities:
- utils.py – shared functions (landmark filtering, mask creation, blending)
- Configuration:
- environment.yml – Conda environment definition (Python, Mediapipe, OpenCV)
- Sample assets:
- sample/ – test image, landmark reference image, output video

##### README for Insights
- Confirms pipeline stages: detection → feature extraction → mask creation → blending → output.
- Highlights external dependencies: MediaPipe Face Landmarker, OpenCV.

##### Main Components and Their Interactions
a. Input Sources
– Static Image Input (image.py)
– Live Camera Stream (camera.py)
b. Face Detection & Landmark Extraction
– MediaPipe Face Landmarker API
c. Feature Extraction
– utils.extract_* functions to select lip, eyebrow, eyeliner, eyeshadow landmark points
d. Mask Generation
e. Blending Engine
– utils.blend_images: merge original frame/image and mask with adjustable alpha weights
f. Output Renderer
– Display on screen (cv2.imshow) or write to file/video (cv2.VideoWriter)

##### Diagramming Relationships
Input → Face Landmarker → Feature Extraction → Mask Generation → Blending → Output
- Calls from camera.py and image.py into utils.py and into MediaPipe API as external service.

##### Architectural Patterns & Principles
- Pipeline / staged‐processing pattern
- Separation of concerns: input handlers, processing utilities, external API integration.
- Modularity: utils.py encapsulates reusable image‐processing functions.

##### Technologies & External Services
- Python 3.x
- Conda environment (environment.yml)
- Google MediaPipe Face Landmarker (external library)
- OpenCV for I/O, drawing, blending

## Diagram (Mermaid)

```mermaid
flowchart TD
    ImageLoader["ImageLoader<br/>(Static Image Input)"]:::io
    CameraCapture["CameraCapture<br/>(Live Camera Stream)"]:::io
    MP["MediaPipe Face Landmarker"]:::external
    FE["FeatureExtractor"]:::processing
    MG["MaskGenerator"]:::processing
    BL["Blender"]:::processing
    Renderer["Output Renderer/Writer"]:::io
    Env["Conda Environment<br/>(environment.yml)"]:::external
    OC["OpenCV"]:::external
    sample["Sample Assets<br/>(sample/)"]:::external

    subgraph "Processing Module"
        FE
        MG
        BL
    end

    ImageLoader -->|"image frame"| MP
    CameraCapture -->|"video frame"| MP
    MP -->|"landmarks"| FE
    FE -->|"feature points"| MG
    MG -->|"mask image"| BL
    BL -->|"blended frame"| Renderer
    Renderer -->|"next frame"| CameraCapture

    %% Click Events
    click ImageLoader "https://github.com/jayanths9/virtual_makeup/blob/main/image.py"
    click CameraCapture "https://github.com/jayanths9/virtual_makeup/blob/main/camera.py"
    click FE "https://github.com/jayanths9/virtual_makeup/blob/main/utils.py"
    click MG "https://github.com/jayanths9/virtual_makeup/blob/main/utils.py"
    click BL "https://github.com/jayanths9/virtual_makeup/blob/main/utils.py"
    click Renderer "https://github.com/jayanths9/virtual_makeup/blob/main/image.py"
    click Renderer "https://github.com/jayanths9/virtual_makeup/blob/main/camera.py"
    click Env "https://github.com/jayanths9/virtual_makeup/blob/main/environment.yml"
    click sample "https://github.com/jayanths9/virtual_makeup/tree/main/sample/"

    classDef io fill:#ADD8E6,stroke:#000,color:#000;
    classDef processing fill:#90EE90,stroke:#000,color:#000;
    classDef external fill:#FFA500,stroke:#000,color:#000;
```
