>-Convert the hfov to a vfov using the aspect ration, as described
>here: http://wiki.panotools.org/Field_of_View
>-Use the condition that r=1 at the h/2 radius, find the depth of the
>image plane, zf
> tan(vfov/2) = r/zf
> zf = r / tan(vfov/2)
>- If our direction vector is (vx, vy, vz), mulitply it by zf/vz, to
>get (ix, iy), a point on the image plane. Points behind the camera or
>too far away can be thrown out.
>- Calculate r = sqrt(ix^2 + iy^2), and distort by multplying (ix, iy)
>* (a r^3 + b r^2 + c r + d) = (dx, dy)
>- multiply (dx, dy) * h/2 to get a number in pixels
>- Interpolate a color from the surrounding pixels in the source image.
Correct, though your assumption is for landscape format images, it
is slightly simpler for portrait.
>Is that actually correct? Can someone point me to where this is done
>in the source code?
math.c in libpano13.
--
Bruno
I am very interested. I have a big research project (currently on
hold) that would benefit from such a discussion.
The panotools polynomial is normalised to the angle of view, i.e. it
is normalised to the vertical or the horizontal angle of view,
whichever is smaller.
This _is_ confusing as it means the 'v' horizontal angle of view
parameter means something completely different for landscape and
portrait images.
e.g. for my Peleng fisheye images, the horizontal angle of view in
portrait orientation is 111 degrees and so is the 'v' parameter.
For landscape images the 'v' parameter is 168, but the lens
correction parameters mean that the actual angle of view covered is
173 degrees.
I think the portrait situation makes a lot more sense, it is sane to
normalise the lens distortion to the narrowest width of the image
since this is well behaved.
--
Bruno