Skip to main content

Dynamo Figures

A Python package for creating composite images from videos. This tool extracts frames from a video and merges them using various composition modes to create stunning visual effects.

Installation

Install from Git

# Install directly from GitHub
pip install git+ssh://git@github.com/dynamicmobility/dynamo_figures.git

Install from Local Directory

# From within the project directory
git clone git@github.com:dynamicmobility/dynamo_figures.git
cd dynamo_figures
pip install -e .

Usage

Command-Line Interface

After installation, you can use the dynamo-composite-image command:

Uses pixels that are furthest from the mean of the image, creating dynamic composite effects.

dynamo-composite-image --video_path ./example/video.mp4 --start_t 0.0 --end_t 99.0 --skip_frame 2 --mode VAR --alpha 0.4 --output ./example/composite.png

image-20230909002327059

2. MIN Mode

Keeps the darkest pixels from all frames.

dynamo-composite-image --video_path ./example/video.mp4 --start_t 0.0 --end_t 99.0 --skip_frame 2 --mode MIN --output ./example/composite.png

image-20230909002235029

3. MAX Mode

Keeps the lightest pixels from all frames.

dynamo-composite-image --video_path ./example/video.mp4 --start_t 0.0 --end_t 99.0 --skip_frame 2 --mode MAX --output ./example/composite.png

image-20230909002149494

Python API

You can also use the package programmatically in your Python scripts:

from dynamo_figures import CompositeImage, CompositeMode
import cv2

# Create a composite image with VAR mode
merger = CompositeImage(
    mode=CompositeMode.MAX_VARIATION,
    video_path="./example/video.mp4",
    start_t=0.0,
    end_t=99.0,
    skip_frame=2,
    alpha=0.4,
    disable_pbar=False  # Set to True to disable the progress bar
)

# Generate the composite
result = merger.merge_images()

# Save the result
cv2.imwrite("output.jpg", result)

Alternative Command-Line Methods

If you haven't installed the package, you can still run it:

# Run as a Python module
python -m dynamo_figures.composite_image --video_path ./example_video.mp4 --mode VAR

# Or run directly
python src/dynamo_figures/composite_image.py --video_path ./example_video.mp4 --mode VAR

Parameters

  • --video_path (required): Path to the input video file
  • --start_t: Start time in seconds (default: 0)
  • --end_t: End time in seconds (default: 999999)
  • --skip_frame: Number of frames to skip when extracting frames. Use 1 to process every frame (default: 1)
  • --mode: Composition mode, three options available:
    • VAR (Recommended): Uses pixels furthest from the mean, creating dynamic variation effects
    • MAX: Keeps the lightest pixels across all frames
    • MIN: Keeps the darkest pixels across all frames
  • --alpha: Alpha blending factor for intermediate frames, range 0.0-1.0 (default: 0.5)
  • --disable_pbar: Disable the progress bar when merging images (flag, no value needed)
  • --output: Custom output file path (default: saves as <video_name>.jpg in the same directory as the input video)

Dependencies

  • Python >= 3.8
  • opencv-python >= 4.0.0
  • numpy >= 1.20.0
  • tqdm >= 4.0.0

License

All Rights Reserved 2023

Credits

Original Author: renyunfan (renyf@connect.hku.hk)

Metadata

Release files for dynamo-figures 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamo-figures 0.3.2
File Size Uploaded Provenance Actions
dynamo_figures-0.3.2.tar.gz 240.2 kB Without provenance Details for dynamo_figures-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dynamo-figures 0.3.2
File Interpreter ABI Platform Actions
dynamo_figures-0.3.2-py3-none-any.whl Python 3 none any Details for dynamo_figures-0.3.2-py3-none-any.whl

Total release size: 482.6 kB

Release files / dynamo_figures-0.3.2.tar.gz

Download URL dynamo_figures-0.3.2.tar.gz
Size 240.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e59a4be0370dc906be1200cfdd3e80f84290d9ad825e058321ebc0afe1c313e3
BLAKE2b-256 checksum
How to use checksums
6125fa1c7289b2490807521bbb5f01dbdc6685af71858d9a8f1e2c4e91017bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / dynamo_figures-0.3.2-py3-none-any.whl

Download URL dynamo_figures-0.3.2-py3-none-any.whl
Size 242.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10f06be9127fca22df2332210e3535f48fa99137631f9e0e127f98097e59bcbe
BLAKE2b-256 checksum
How to use checksums
4476f9e53be064a0f8a9fe0b97896ff1e316bc358e90c260cc35f89d9c0b9fd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for dynamo-figures 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page