Skip to content

Add slit-image videogram mode with selectable sampling lines - #366

Merged
alexarje merged 3 commits into
masterfrom
copilot/add-photo-finish-image-option
Aug 22, 2026
Merged

Add slit-image videogram mode with selectable sampling lines#366
alexarje merged 3 commits into
masterfrom
copilot/add-photo-finish-image-option

Conversation

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Videograms previously only supported axis-averaged rendering. This update adds a photo-finish/slit mode that samples one row or one column per frame over time, with explicit line selection.

  • API: videograms slit mode

    • Extended MgVideo.videograms(...) with:
      • mode: "average" (existing behavior) or "slit"
      • line_x: sampled column index for vertical slit videogram
      • line_y: sampled row index for horizontal slit videogram
    • average mode behavior remains unchanged.
    • In slit mode, output filenames default to _vgv_slit.png / _vgh_slit.png.
    • Added slit-mode validation for mode, line_x, and line_y bounds.
  • FFmpeg pipeline updates

    • Implemented slit extraction using per-frame crop + tile (time stacking).
    • Added RGB conversion before 1-pixel crop to avoid YUV subsampling crop constraints.
  • CLI support

    • Extended musicalgestures videograms with:
      • --mode [average|slit]
      • --line-x
      • --line-y
  • Targeted test coverage

    • Added tests for slit output creation, expected dimensions, input validation, and average-mode compatibility when line args are provided.
import musicalgestures as mg

v = mg.MgVideo("input.mp4")
# photo-finish style videograms from chosen column/row
out = v.videograms(mode="slit", line_x=120, line_y=240)
print([img.filename for img in out])  # *_vgv_slit.png, *_vgh_slit.png

Copilot AI linked an issue Aug 22, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits August 22, 2026 14:34
Co-authored-by: alexarje <114316+alexarje@users.noreply.github.com>
Co-authored-by: alexarje <114316+alexarje@users.noreply.github.com>
Copilot AI changed the title [WIP] Add photo finish image option to videogram Add slit-image videogram mode with selectable sampling lines Aug 22, 2026
Copilot AI requested a review from alexarje August 22, 2026 14:39
@alexarje
alexarje marked this pull request as ready for review August 22, 2026 15:07
@alexarje
alexarje merged commit 0b84762 into master Aug 22, 2026
@alexarje
alexarje deleted the copilot/add-photo-finish-image-option branch August 24, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add photo finish image option to videogram

2 participants