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 -
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 -
- code from pano2fisheye and fisheye2pano
- references and explanations at http://paulbourke.net/dome/fisheye/ - especially the hemispherical fisheye vs angular fisheye and so on.
- the simplest orthographic projection from Wikipedia
- Map projections at Wolfram's Mathworld
- Transformation matrices at Wikipedia
- From the 3D projection page, the Parallel projection page
No comments:
Post a Comment