Skip to content

smallcluster/tinybma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tinybma

An optical flowmap generator from motion vectors using a Full Search Block Matching Algorithms (FSBMA) written in c++

Features:

  • SAD based motion compensation on the luma chanel only (input images are converted from full sRGB to YUV BT.601)
  • New: Bilinear subpixel motion compensation !
  • Two visualization mode for computed motion vectors:
    • HSV mode where hue encodes orientation and value encodes normalized norm relative to the maximum displacement
    • UV mode where the red and green channels encode horizontal and vertical displacement
  • Luma, residue and prediction visualization
  • Reasonably fast: Block search and pixels transforms use all available cpu cores
Video demo
  • Badapple but its a block matched motion compensation ! (before the 2026/03/09 update) YT demo

Build

cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build .

Usage

Use tinybma -h to display program help.

Example

tinybma ./example/sintel_source.png ./example/sintel_target.png ./example/flowmap_b4_m16.png -v -b 4 -m 16 -l -r -p -s 1 -c hsv 

Which produces the following optical flowmap and residue based on two frames from The Blender open movie project Sintel:

Original reference frame (left) and original target frame (right)

1/4 optical flowmap with max search of 16px + 1 subpixel (left) and the residual image (right)


Predicted luma frame from computed motion vectors and residue

Available colormaps

HSV map UV map
Option --colormap hsv or -c hsv --colormap uv or -c uv
Result

Changelogs

  • 2026/03/09
    • Added prediction frame visualisation
    • Fixed residue visualisation, now negative values were campled to 0
    • Added subpixel motion based on bilinear upsampling after whole pixel motion
    • Switched search metric from MSE to SAD

About

Optical flowmap from motion vectors using block matching algorithms in c++

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors