wiki:

RemapFilter


Version 7 (modified by fsluiter, 3 years ago) (diff)

--

Note: this filter is currently in development, not yet in the official release

This filter copies pixel by pixel a source frame to a target frame. It remaps the pixels to a new x,y destination based on two files ymap/xmap. Map files are passed as a parameter and are in PGM format (P2 or P5), where the values are y(rows)/x(cols) coordinates of the source_frame. The *target* frame dimension is based on mapfile dimensions: specified in the header of the mapfile and reflected in the number of datavalues. Dimensions of ymap and xmap must be equal. Datavalues must be positive or zero. Any datavalue in the ymap or xmap which value is higher then the *source* frame height or width is silently ignored, leaving a blank/chromakey pixel. This can safely be used as a feature to create overlays.

Algorithm digest: Target_frame[y][x] = Source_frame[ ymap[y][x] ][ [xmap[y][x] ];

Example command: ffmpeg -i fisheye_grid_input.jpg -i fisheye_grid_xmap.pgm -i fisheye_grid_ymap.pgm -lavfi remap out.png

Example files are attached to this page.

This can be used to create 360 movies with equirectangular projection, for example to upload to youtube. Attached also for specific 360 camera's:

  • Ricoh Theta S camera: input files for resolution 1920x960(1080).
  • Samsung gear camera: input files for resolution 2560x1280

Note: if you have a different camera or need other resolutions, let me know ( fsluiter_at_gmail.com). I can generate the input files if you sent me a sample frame.

Attachments (6)