PanoTools NG:
Panotools rounding bug?
Steinar Midtskogen steinar@... 2014-Dec-12 14:19:14
Hello,
I'm using panotools to have a way to map pixel positions from images
taken from a camera with fixed mounting to azimuth and altitude. I've
found the lens parameters to do this mapping, so I have this .pto file:
p f2 w360 h180 v360 E0 R0 n"TIFF_m c:LZW"
i w2560 h1920 f20 v115.300003051758 Ra0 Rb0 Rc0 Rd0 Re0 Eev0 Er1 Eb1 r-91.5480454981774 p56.1206691041098 y-116.148308683515 TrX0 TrY0 TrZ0 j0 a0.0652360889615975 b-0.118396567769254 c0.0640016515343118 d-36.3733937252929 e-42.9029343890171 g-402.633165871505 t536.698532676161 Va1 Vb0 Vc0 Vd0 Vx0 Vy0 Vm5 n"/home/steinar/track/out/clean_201412090100.jpg"
This will map x in my Thoby fisheye image to azimuth and y to
90-altitude. That is, if y is 0, I should get the same result
regardless of x (y = 0 means the pole). But this is what I get:
$ echo 0 0 90 0 180 0 270 0 | pano_trafo -r lens.pto 0
2040.171640 1084.863599
2031.337128 1100.300503
2044.760528 1109.326401
2053.617284 1093.875862
However, if I use -0.5 for y, then x doesn't matter:
$ echo 0 -0.5 90 -0.5 180 -0.5 270 -0.5 | pano_trafo -r lens.pto 0
2042.489582 1097.095860
2042.489582 1097.095860
2042.489582 1097.095860
2042.489582 1097.095860
The unexpected shift of -0.5 remains the same even if I rescale the
output, e.g. multiplying by 1000:
p f2 w360000 h180000 v360 E0 R0 n"TIFF_m c:LZW"
I still get the same with the output rescaled in the pto file:
$ echo 0 -0.5 90 -0.5 180 -0.5 270 -0.5 | pano_trafo -r lens.pto 0
2042.489582 1097.095860
2042.489582 1097.095860
2042.489582 1097.095860
2042.489582 1097.095860
However, if I now use y=0, I get something much closer to what I
originally expected:
$ echo 0 0 90 0 180 0 270 0 | pano_trafo -r lens.pto 0
2042.487385 1097.083601
2042.487367 1097.083606
2042.487350 1097.083611
2042.487332 1097.083616
If I had been actually creating an output image, an offset of half a
pixel probably isn't a big deal. Still, this must be some kind of bug?
The workaround is simple, I can just rescale by a lot (since I'm only
using pano_trafo and will never actually create an image, the size
doesn't matter).
--
Steinar
------------------------------------
Posted by: Steinar Midtskogen <#removed#>
------------------------------------
--
<*> Wiki: http://wiki.panotools.org
<*> User Guidelines: http://wiki.panotools.org/User_Guidelines
<*> Nabble (Web) http://panotoolsng.586017.n4.nabble.com/
<*> NG Member Map http://www.panomaps.com/ng
<*> Moderators/List Admins: #removed#
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/PanoToolsNG/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/PanoToolsNG/join
(Yahoo! ID required)
<*> To change settings via email:
#removed#
#removed#
<*> To unsubscribe from this group, send an email to:
#removed#
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/