# lasyaed/matchcutting architecture

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

- Interactive diagram: https://gitdiagram.com/lasyaed/matchcutting
- Repository: https://github.com/lasyaed/matchcutting

## Overview

##### Project type and purpose
- This is an open-source, command-line Python toolkit for video analysis.
- It provides a set of standalone scripts (shot segmentation, image deduplication, scene visualization, optical-flow generation and comparison) that can be chained or used independently.

##### File structure
- Top-level scripts each implement one task:
- shot_segmentation.py
- deduplication_black_and_white.py
- visualize_scene_cuts.py
- optical_flow_representation.py
- compare_optical_flow.py
- Supporting files:
- requirements.txt (lists dependencies: scenedetect, EfficientNet, OpenCV, etc.)
- scene_list.pkl (output from shot segmentation)
- README.md (project overview and usage)

##### README for additional insights
- Lists each script’s function, inputs, outputs, and use cases.
- Mentions core algorithms: content-detector (scenedetect), cosine similarity over deep features, Farneback/Lucas-Kanade optical flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Input
    VideoFile["Video File"]:::input

    %% Processing Modules
    ShotSeg["Shot Segmentation Module"]:::processing
    SceneVis["Scene Cuts Visualization Module"]:::processing
    Dedup["Image Deduplication Module"]:::processing
    FlowGen["Optical Flow Generation Module"]:::processing
    FlowComp["Optical Flow Comparison Module"]:::processing

    %% Artifacts
    SceneList["scene_list.pkl"]:::output
    SceneCuts["scene_cuts/ (images)"]:::output
    Deduped["deduped_scene_cuts/"]:::output
    FlowImages["flow_images/"]:::output
    Report["similarity_report/"]:::output

    %% External Dependencies
    Requirements["requirements.txt"]:::external
    Readme["README.md"]:::external

    %% Data Flow
    VideoFile --> ShotSeg
    ShotSeg -->|"scene_list.pkl"| SceneList
    SceneList --> SceneVis
    SceneVis -->|"scene_cuts images"| SceneCuts
    SceneCuts --> Dedup
    Dedup -->|"deduped images"| Deduped

    %% Optical flow branches
    VideoFile -.->|"raw frames"| FlowGen
    Deduped -->|"frames input"| FlowGen
    FlowGen -->|"flow images"| FlowImages
    FlowImages -->|"images input"| FlowComp
    FlowComp -->|"report files"| Report

    %% External Links
    Requirements
    Readme

    %% Click Events
    click ShotSeg "https://github.com/lasyaed/matchcutting/blob/main/shot_segmentation.py"
    click SceneVis "https://github.com/lasyaed/matchcutting/blob/main/visualize_scene_cuts.py"
    click Dedup "https://github.com/lasyaed/matchcutting/blob/main/deduplication_black_and_white.py"
    click FlowGen "https://github.com/lasyaed/matchcutting/blob/main/optical_flow_representation.py"
    click FlowComp "https://github.com/lasyaed/matchcutting/blob/main/compare_optical_flow.py"
    click Requirements "https://github.com/lasyaed/matchcutting/blob/main/requirements.txt"
    click Readme "https://github.com/lasyaed/matchcutting/blob/main/README.md"
    click SceneList "https://github.com/lasyaed/matchcutting/blob/main/scene_list.pkl"

    %% Styling
    classDef input fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef processing fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef output fill:#ffe5cc,stroke:#333,stroke-width:1px
    classDef external fill:#dddddd,stroke:#333,stroke-width:1px
```
