Tuesday, March 31, 2020

tool for converting 360 videos to fulldome - making of OCVWarp

I'd previously posted about OCVWarpNorth. Now, OCVWarp is finally ready with Equirectangular to 180 degree Fisheye conversion of arbitrary fields of view.

The delay was due to bugs, which I finally squashed by getting a better understanding of the transformation equations using Octave.

I'd intuitively assumed that applying a rotation tranformation to Px, Py, Pz in http://paulbourke.net/dome/dualfish2sphere/diagram.pdf should do the trick for getting any field of view. But I was done in by a bug introduced fairly stupidly, when I had specified the same variables on both sides of the rotation, like
Py = cos(angleyrad) * Py - sin(angleyrad) * Pz;
Pz = sin(angleyrad) * Py + cos(angleyrad) * Pz; 
// here, Pz gets calculated with the new Py 
//instead of with the old Py - this is the bug
instead of
PyR = cos(angleyrad) * Py - sin(angleyrad) * Pz;
PzR = sin(angleyrad) * Py + cos(angleyrad) * Pz;

I'll prepare a separate post comparing OCVWarp and ffmpeg's v360 filter.

One of the interesting views obtained during the learning process with Octave - from equidist.m, after a rotation -





This image gives some idea of the interpolation going on, especially for a low-res image - the black areas are non-interpolated, etc.

While reading up to do debugging, I found the following quite useful -
and finally, of course, just doing tests in Octave. 

No comments:

Post a Comment