« Return to Thread: What is optimized FOV really?

Re: What is optimized FOV really?

by Aron H :: Rate this Message:

Reply to Author | View in Thread


Hi Klaus,

On Jul 1, 1:31 pm, Klaus Foehl <k...@...> wrote:

> Hello Aron,
>
> If I understand hugin and the undelying panotools correctly, then the
> maths direction is already in the direction you require. In the output
> image, equirectangular, you already have theta and phi angle in 3D for
> each pixel. Distance to object is missing of course. With this (x,y)
> which in equirectangular projection is (phi,theta) hugin, well
> panotools needs to know which camera pixel it needs to look at.
>
> So one way would be to look up the formulas in the source code.

Can someone point me in the right direction? The doxygen pdf has 300+
pages :)

>
> I presume that output coordinates are first transformed into focal
> plane coordinates using standard lense formula and for this the hfov
> number is used. Then a new radius is computed from the a,b,c plus d
> formula. Of course after that correction for a non-square input image
> the hfov angle is not the real horizontal angle as captured with the
> sensor. I would cling to points at h/2 radius as these are not
> affected by the a+b+c+d correction. Given that your input images have
> a know aspect ratio, for the maths to start I would convert the hfov
> value into a vfov value which survives the correction unchanged.

Let me attempt some pseudo-code, which a developer can correct?

Given a pixel in the final panorama image, find what sub-pixel it maps
to
in a given input image:
-Given 0,0 in the image center, and FOV, find a yaw/pitch for the
pixel, and make a direction vector.
-Rotate that vector by the image's yaw-pitch-roll angles, so it is now
in camera coordinates
-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.

Is that actually correct? Can someone point me to where this is done
in the source code?
BTW, I do OpenGL as part of my job, and I'd be happy to answer
questions/help on that subject....
>
> Hope that helps
>
> Klaus
Regards,
Aron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@...
To unsubscribe from this group, send email to hugin-ptx-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: What is optimized FOV really?