[ptx] fulla bugs

Pablo d'Angelo pablo.dangelo at web.de
Tue Jun 6 23:50:40 BST 2006


Hi Bruno,

Bruno Postle schrieb:

> On Tue 06-Jun-2006 at 10:37 +0100, Bruno Postle wrote:
>>
>> It looks like the red and green channels are remapped correctly, but
>> something different happens to blue.  I can't test here, but maybe the
>> barrel distortion isn't being applied to the blue channel.
> 
> I'm wrong, there is a major difference but it is just with the tca
> parameters.  Previously, this fulla command did a subtle tca correction
> moving the blue channel about 2 pixels at the edge:
> 
>  fulla  -r -0.000183:0.001241:-0.000890:1.000554 \
>         -b -0.018228:0.035394:-0.021134:1.004761 \
>         $@

After 2 hours of hunting for the bug I actually looked at the correction
values specified above.

Actually, the previous version of fulla contained a serious bug, that lead
to wrong correction parameters. Basically, only the linear correction (d
parameter) was used.. So the version from tonight is correct.

The parameters above lead to the following scaling at the very edges of the
image: (because of the relatively high a coefficient of the -b parameter)


octave:1> coeff_r= [ -0.000183 0.001241 -0.000890 1.000554]
coeff_r =

   -1.8300e-04    1.2410e-03   -8.9000e-04    1.0006e+00

octave:2> coeff_b = [ -0.018228 0.035394 -0.021134 1.004761];
octave:3> image_size=[2056 3088];
octave:4> scale = min(image_size)/2
scale = 1028
octave:5> r_corner = norm(image_size/2)/scale
r_corner = 1.8044
octave:6> scale_factor_at_corner_blue = polyval(coeff_b, r_corner)
scale_factor_at_corner_blue = 0.97478
octave:7> scale_factor_at_corner_red = polyval(coeff_r, r_corner)
scale_factor_at_corner_red = 1.0019
octave:8> scale_factor_at_corner_blue* norm(image_size/2)
ans = 1808.1
octave:9> scale_factor_at_corner_blue* norm(image_size/2) - norm(image_size/2)
ans = -46.785
octave:10>

Unfortunately, the old fulla version totally ignored the higher coefficients
(maybe the very first version worked correctly, added the scaling to remove
the borders/color edges later).

> With CVS from last night, the red and green channels are about 10 pixels
> displaced from the blue channel at the edges.

Actually, at the very corners it should be even more, around ~46 pixels.

This can happen if the correction coefficents are estimated as described in
the howto on the hugin site, and there are not control points in the very
corners. Polynomials do not behave well when extrapolating. Its better to
choose a lower order (just optimize fov and c, for "normal" lenses).

ciao
  Pablo


More information about the ptx mailing list