# harsh3029/digital-watermarking architecture

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

- Interactive diagram: https://gitdiagram.com/harsh3029/digital-watermarking
- Repository: https://github.com/harsh3029/digital-watermarking

## Overview

##### Project type and purpose
- This is a research‐oriented image processing pipeline (an open‐source tool / case study) for embedding and extracting invisible watermarks in digital images using visual cryptography.
- The four Python scripts each implement one stage of the pipeline:
- ownership_share_generator.py – builds the ownership share from the original watermark and host image
- master_share_generator.py – extracts master shares from possibly stolen/modified images
- watermark_generator.py – reconstructs the watermark by combining master + ownership shares
- template_match_res.py – computes accuracy of the reconstructed watermark

##### File structure
- Top‐level:
- Code/ – all processing scripts
- images/ – input sample images and generated outputs (master_images, stolen_images, regenerated_watermarks)
- LICENSE, README.md
- No services or databases: it’s a pure local pipeline.
- The four scripts execute in sequence (or independently) to form the full watermark cycle.

##### README
- Confirms project goal (visual cryptography watermarking).
- Lists run order and how each script interacts with image assets.

1. Input Data
– Original host image(s)
– Binary watermark image
2. Ownership Share Generator (Script 1)
3. Master Share Generator (Script 2)
4. Watermark Extractor (Script 3)
5. Accuracy Evaluator (Script 4)
6. Output Data
– Ownership share file
– Master share images
– Reconstructed watermarks
– Accuracy metrics
– Watermark + Host Image → Ownership Share Generator → Ownership Share
– For each stolen/modified Image + Ownership Share → Master Share Generator → Master Share
– Ownership Share + Master Share → Watermark Extractor → Reconstructed Watermark
– Reconstructed Watermark + Original Watermark → Template Matcher → Accuracy Score
c. Architectural patterns / principles:
– Pipeline pattern: clearly segmented processing steps
– Data‐driven flow: each script reads from images/ and writes back
– Single responsibility: each script has one discrete function
d. Key technologies & libraries:
– Python 3.x
– Image-processing libs (Pillow or OpenCV)
– File-system I/O for image assets
– Any pseudo-random generator module for point selection

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Stores
    images_input["images/ (Host Images & Binary Watermark)"]:::datastore
    stolen_images["images/stolen_images/"]:::datastore
    ownership_output["images/ (Ownership Shares)"]:::datastore
    master_images["images/master_images/"]:::datastore
    regen_watermarks["images/regenerated_watermarks/"]:::datastore
    accuracy_metrics["Accuracy Metrics"]:::metrics

    %% Processing Scripts
    ownership_gen["Ownership Share Generator"]:::script
    master_gen["Master Share Generator"]:::script
    watermark_ext["Watermark Extractor"]:::script
    accuracy_eval["Accuracy Evaluator"]:::script

    %% Data Flow
    images_input -->|"host & watermark"| ownership_gen
    ownership_gen -->|"ownership shares"| ownership_output

    stolen_images -->|"stolen images"| master_gen
    ownership_output -->|"ownership shares"| master_gen
    master_gen -->|"master shares"| master_images

    ownership_output -->|"ownership shares"| watermark_ext
    master_images -->|"master shares"| watermark_ext
    watermark_ext -->|"reconstructed watermarks"| regen_watermarks

    images_input -->|"original watermark"| accuracy_eval
    regen_watermarks -->|"reconstructed watermarks"| accuracy_eval
    accuracy_eval -->|"accuracy score"| accuracy_metrics

    %% Click Events
    click images_input "https://github.com/harsh3029/digital-watermarking/tree/main/images/"
    click ownership_gen "https://github.com/harsh3029/digital-watermarking/blob/main/Code/owernership_share_generator.py"
    click ownership_output "https://github.com/harsh3029/digital-watermarking/tree/main/images/"
    click stolen_images "https://github.com/harsh3029/digital-watermarking/tree/main/images/stolen_images/"
    click master_gen "https://github.com/harsh3029/digital-watermarking/blob/main/Code/master_share_generator.py"
    click master_images "https://github.com/harsh3029/digital-watermarking/tree/main/images/master_images/"
    click watermark_ext "https://github.com/harsh3029/digital-watermarking/blob/main/Code/watermark_generator.py"
    click regen_watermarks "https://github.com/harsh3029/digital-watermarking/tree/main/images/regenerated_watermarks/"
    click accuracy_eval "https://github.com/harsh3029/digital-watermarking/blob/main/Code/template_match_res.py"

    %% Styles
    classDef script fill:#D6EAFE,stroke:#3182bd,stroke-width:1px;
    classDef datastore fill:#E2F0D9,stroke:#2f855a,stroke-width:1px;
    classDef metrics fill:#FFE0B2,stroke:#dd6b20,stroke-width:1px;

    class ownership_gen,master_gen,watermark_ext,accuracy_eval script;
    class images_input,stolen_images,ownership_output,master_images,regen_watermarks datastore;
    class accuracy_metrics metrics;
```
