I got curious about how radial correction is computed and did a small test.
From Helmut's description (remember, he implemented the code):
http://www.all-in-one.ee/~dersch/barrel/barrel.html I learned that the
correction is
dd + cr + br^2 + ar^3 (found in the function radial).
Noticed the first parameter dd. In the page above is referred as d,
but d in panotools has a different meaning.
As he explains, to avoid scaling the sum of dd + c + b + a = 1.
This is supported by the code. dd is computed from a, b and c to
satisfy the invariant.
Now, look at the following test:
http://turingmachine.org/~dmg/temp/test_grid.zip
It looks as if, in the case of the 2 rectangular images, there is
scaling, but not in the squarish image.
In the code, the scale of the image is normalized as 1/2 the smallest
of dimensions. This means the image is not scaled with respect to the
longest dimension,
but it is scaled with respect to the shortest dimension. Now, this
example is a bit extreme because the ration width to length is 2. But
even if it was 1.5 (as with
36mm cameras) the different is significant.
I suspect helmut did this because most people shoot panoramas with the
camera in portrait mode. This way the "horizontal" field of view,
remains unchanged
after the correction has been applied.
With this information we should be able to computer a, b and c
parameters from imatest data (such as the ones published at photozone:
http://www.photozone.de/canon-eos/336-canon-ef-35mm-f14-test-report--review?start=1)
What about the samyang 8mm lens? This radial correction is made before
the photo is remapped to its native projection. One would need to
either: calibrate the lens using the typical methods, or do some math
and approximations
to come to the estimation of these parameters based on the formulas
above. Remember, the lens is closer to stereographic (which we have
implemented in panotools), do not use for this one a typical
equidistant.
Samyang should donate us a couple of lenses to be able to properly
test the code. It has never been used.
--dmg
---
Daniel M. German
http://turingmachine.org
-dmg
--
Hi Daniel
Am 03.01.2011 12:24, schrieb dmg:
> Samyang should donate us a couple of lenses to be able to properly
> test the code. It has never been used.
>
I have a Samyang 8mm. Let me know if you need test pictures (and what
they should contain). If required, I could even be convinced to lend it
to a developer.
Regards
Stefan Peter
- --
In theory there is no difference between theory and practice. In
practice there is.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNIcKoAAoJEBgqi52L7+L/I7kH/RTxGT2jmQ9lLrOJtgxa8WbV
BZlOkvND9ESvnhCjPSXtFFSHbjPMbppnSes/YzAqq2ZcF7Zsjrp9rIQlKrA/YmTc
Vodfm5VzfbGdaKwaal7KNUAMTVEmU+3owVTHGBOa0b2nbPlWIrr11Jm4Gww4UnZO
y3M1COixtANfM8EHJhkGqZvonEnfNId455nQDGIneGCsx6veYGMSOySGUdIShrtn
RSq0r2++N8c9MAEvBlT7A41z+9Zem7NWi6Wu9Kpp58f+E9PVC4a7iFg/2+2UcQCD
pntJR+qfcAtZOfyDeK+QmIgPqtw/KjB2kDu4MplwidHa8viDy0QZq4ntVy9SQf0=
=qI0C
-----END PGP SIGNATURE-----
In practice the polynomial changes the angular distance between
adjacent stitching seams whatever the photo orientation. The fact
that the angular distance between the sides of a portrait photo
doesn't change isn't that interesting since we rarely use the data
at the sides.
>I wonder if a better solution would be to scale with respect to the
>corner of the frame.
...and abandon the a,b,c polynomial while we are at it. There are
definitely better lens models, the question is do we need the pain
involved with changing from the existing model?
--
Bruno
>> I got curious about how radial correction is computed and did a small test.
>>
>> [snip]
>> It looks as if, in the case of the 2 rectangular images, there is
>> scaling, but not in the squarish image.
>>
>> In the code, the scale of the image is normalized as 1/2 the smallest
>> of dimensions. This means the image is not scaled with respect to the
>> longest dimension, but it is scaled with respect to the shortest
>> dimension. Now, this example is a bit extreme because the ration
>> width to length is 2. But even if it was 1.5 (as with 36mm cameras)
>> the different is significant.
>>
>> I suspect helmut did this because most people shoot panoramas with the
>> camera in portrait mode. This way the "horizontal" field of view,
>> remains unchanged after the correction has been applied.
I was sure it was the longest dimension used. I had to go back and check. You
are right it is shortest. I thought that if shooting portrait and instead of
using the minimum number of images needed to make a pano a whole bunch of images
used and cropped down narrow strips of only a few degrees each the same abc
values could be used. But this is not the case.
>> --dmg
>>
>> ---
>> Daniel M. German
>> http://turingmachine.org
--
Jim Watters
http://photocreations.ca
We can leave it as is, and provide a better model, but what would the
alternatives be?
--dmg
>
> --
> Bruno
>
> --
> 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 hugi...@googlegroups.com
> To unsubscribe from this group, send email to
> hugin-ptx+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/hugin-ptx
It has been pointed out that the polynomial should only consist of
even numbered powers, both for speed and for mathematical soundness.
The distortion could be a function of angle and not proportion of
width of image. This would make discussions about whether to use
diagonal, width or height irrelevant. Also a single lens would have
the same parameters regardless of sensor size.
Tom Sharpless wrote a system that used a spline rather than a
polynomial curve, this is what is implemented in calibrate_lens. In
principle this would be more stable when optimising and faster when
rendering.
--
Bruno
> It has been pointed out that the polynomial should only consist of
> even numbered powers, both for speed and for mathematical soundness.
>
I'm not convinced there is anything wrong with odd powers in a radial
correction function; since R is always >= 0 the odd symmetry is never
manifested.
Ok. So the function y = x has exponent 1, and is not suitable. There
is a sharp corner at x=0, which mathematically manefests itself as a
discontinuity of the derivative:
dy/dx = 1 where x > 0
and = -1 where x < 0 (and undefined for x=0)
Now the derivative of
y = x ^3
is
y = 3 x^2
which after mirroring in x=0 becomes....
dy/dx = 3 x^2 where x > 0
and = 3 (-x)^2 where x < 0
which simplifies to
dy/dx = 3 x^2 for all x.
Even if we're talking about even powers, where the simplification
doesn't work, the value of the derivative is always zero at x=0, so
the derivative won't be discontinuous.
So I understand why the first power is bad, but why the third and
fifth?
(I'm thinking that this is for correcting lens distortions of the form
where pixels belonging at r,theta end up at r',theta on the sensor,
with r' = f (r), and f (x) = x + .... and we're talking about the
.... part Correct?)
Roger.
--
** R.E....@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
** Delftechpark 26 2628 XH Delft, The Netherlands. KVK: 27239233 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement.
Does it sit on the couch all day? Is it unemployed? Please be specific!
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ
thinking aloud, the fact that the field of view changes when the image is in landscape mode might have interesting repercussions during optimization. I wonder if a better solution would be to scale with respect to the corner of the frame. -dmg
Some lenses eg. the 10.5mm Nikkor on full frame can give you a good stitch with a fairly wide range of fov because of the magnification effects of a, b and c eg. from 190 to 200. So I usually force the optimizer to accept a fov of 196 and an a of -0.16 until towards the end of the optimisation process. Only after I iterate point pair elimination and get the error average down to 3 or 4 pixels do I start to optimise fov and a, b and c generally. But for many purposes a wide fov range of values might look ok with that lens. PeterM
Yes it has obvious technical shortcomings, but I'm not certain they
are actually a problem in practice. Switching Hugin to a different
system for would be very disruptive.
--
Bruno