Lens calibration for RAW with a JPEG reference

202 views
Skip to first unread message

tosca

unread,
May 18, 2012, 4:40:55 AM5/18/12
to hugin and other free panoramic software
Hi,

I'm new to both the group and Hugin, just trying to calibrate the
'lenses' of a Canon Powershot S100 that are not yet in the LensFun
database; the JPEG files produced by the camera are OK (Canon's job!)
and I would like to use them as references to fix the RAW files
distortion.

I've shooted in RAW+JPEG, converted the RAW to a TIFF file, opened
both TIFF and JPEG files in Hugin, defined the JPEG as the reference
image. Apparently, Hugin automatically finds a lot of corresponding
points in the two images, and that seems fine.
From there, is there a way to tell 'him' to calculate the lens
distorsion parameters, instead of trying to assemble the two pictures
as a pano?

Thanks for your answer.

Carlos Eduardo G. Carvalho (Cartola)

unread,
May 18, 2012, 8:33:46 AM5/18/12
to hugi...@googlegroups.com
Have you tried this tutorial: http://hugin.sourceforge.net/tutorials/calibration/

You can shoot a floor or any scene that already has lines, instead of putting your lines there.

Cheers,

Carlos E G Carvalho (Cartola)
http://cartola.org/360
http://cartola.org/panoforum



2012/5/18 tosca <mnaug...@gmail.com>

--
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

kfj

unread,
May 19, 2012, 2:12:06 PM5/19/12
to hugin and other free panoramic software


On 18 Mai, 10:40, tosca <mnaugen...@gmail.com> wrote:
> Hi,
>
> I'm new to both the group and Hugin, just trying to calibrate the
> 'lenses' of a Canon Powershot S100 that are not yet in the LensFun
> database; the JPEG files produced by the camera are OK (Canon's job!)
> and I would like to use them as references to fix the RAW files
> distortion.

Do you mean to say that the camera does remove lens distortion from
the images already? I'd be cautious with that claim; I'd say the best
calibtation results are still to be had from a 360X180 with lots of
overlap, even if you have to do a few dozen shots for it - you'd do
that with the widest-angle setting you have and you can use these
images as a reference later on when you use longer lens settings and
can only manage a section of the full 360X180. Or. alternatively, you
can walk the path of the straight lines.

> I've shooted in RAW+JPEG, converted the RAW to a TIFF file, opened
> both TIFF and JPEG files in Hugin, defined the JPEG as the reference
> image. Apparently, Hugin automatically finds a lot of corresponding
> points in the two images, and that seems fine.
> From there, is there a way to tell 'him' to calculate the lens
> distorsion parameters, instead of trying to assemble the two pictures
> as a pano?

In the optimizer tab, switch to user-defined parameters. Uncheck
everything apart from the values you want, probably you will want
v,a,b, and c - only for the TIFF made from the RAW image, while the
other image, which you claim to be correct, should have these set to
the correct fov for v and zero for a,b, and c. Then optimize.

Kay

Marie-Noëlle Augendre

unread,
May 19, 2012, 2:37:21 PM5/19/12
to hugi...@googlegroups.com
Thanks. I will try this one.

Marie-Noëlle

2012/5/18 Carlos Eduardo G. Carvalho (Cartola) <cart...@gmail.com>
Have you tried this tutorial: http://hugin.sourceforge.net/tutorials/calibration/

You can shoot a floor or any scene that already has lines, instead of putting your lines there.

Cheers,

Carlos E G Carvalho (Cartola)
http://cartola.org/360
http://cartola.org/panoforum



--
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



--


Mes dernières photos sont dans ma galerie.
Retrouvez-moi aussi sur mon blog.
Et parcourez les Cévennes à ma façon avec Cévennes Plurielles,

Marie-Noëlle Augendre

unread,
May 19, 2012, 2:51:23 PM5/19/12
to hugi...@googlegroups.com
2012/5/19 kfj <_k...@yahoo.com>



Do you mean to say that the camera does remove lens distortion from
the images already?

On a compact (point-and-shoot?) camera with integrated lens, I guess the JPEG come as "ready to publish". And the manufacturer is probably the one who knows best about his own lens distortions. Or not?
 
I'd be cautious with that claim; I'd say the best
calibtation results are still to be had from a 360X180 with lots of
overlap, even if you have to do a few dozen shots for it - you'd do
that with the widest-angle setting you have and you can use these
images as a reference later on when you use longer lens settings and
can only manage a section of the full 360X180. Or. alternatively, you
can walk the path of the straight lines.

What do you mean by 360x180?
Anyway, you cannot change lenses on this camera; but I need the correction for the whole range of focals (24mm to 120mm)

In the optimizer tab, switch to user-defined parameters. Uncheck
everything apart from the values you want, probably you will want
v,a,b, and c - only for the TIFF made from the RAW image, while the
other image, which you claim to be correct, should have these set to
the correct fov for v and zero for a,b, and c. Then optimize.

Kay

I ended up doing just this. I got a set of a-b-c parameters for 7 different focals, but the result is not so nice; I don't know whether the problem is with Hugin, or with the other programs using the LensFun database.

Marie-Noëlle

Marie-Noëlle Augendre

unread,
May 20, 2012, 11:40:23 AM5/20/12
to hugi...@googlegroups.com
Just did a go at this tutorial http://libregraphicsworld.org/blog/entry/creating-lens-distorsion-models-with-hugin-lens-calibrator , with a grid I shooted with 7 different focals. Plenty of lines detected for each image, so I guess to calibration tool had everything it needed.

Resulting parameters seem to be OK for the biggest focals 18.4, 21.6 and 26.
But the images remain very distorted for the little ones: 5.2, 6, 7.5 and 10.8 (with a 4.59 crop factor).
I used TIFF images converted from the original RAW pictures

Any idea how I can make some progress on the matter?

Thanks a lot,
Marie-Noëlle

2012/5/18 Carlos Eduardo G. Carvalho (Cartola) <cart...@gmail.com>


You can shoot a floor or any scene that already has lines, instead of putting your lines there.

Cheers,

Carlos E G Carvalho (Cartola)
http://cartola.org/360
http://cartola.org/panoforum


kfj

unread,
May 20, 2012, 12:49:09 PM5/20/12
to hugin and other free panoramic software
On 19 Mai, 20:51, Marie-Noëlle Augendre <mnaugen...@gmail.com> wrote:
> 2012/5/19 kfj <_...@yahoo.com>

> > I'd be cautious with that claim; I'd say the best
> > calibtation results are still to be had from a 360X180 with lots of
> > overlap, even if you have to do a few dozen shots for it - you'd do
> > that with the widest-angle setting you have and you can use these
> > images as a reference later on when you use longer lens settings and
> > can only manage a section of the full 360X180. Or. alternatively, you
> > can walk the path of the straight lines.
>
> What do you mean by 360x180?

I mean a full spherical 360 by 180 degrees panorama. Covering the
whole sphere allows you to precisely measure the field of view, and if
the images overlap well, say by 50 percent, and you have created lots
of control points by using the appropriate cpfind parameters (I
recommend using cpfind with these parameters for the purpose: --
fullscale --sieve2size 5 -o %o %s), just optimizing the lot will give
you good lens distortion parameters to work with. Then you have a
reference to 'pin' the longer lens images to - you can just put them
into the same project. But all of this has to be done in a proper
panorama setup, with a well set-up panorama head. Freehand panoramas
won't really do for calibration.

Anyway, it's all in the various tutorials, just browse for a technique
you like. Using lines is fine as well, but keep in mind that if you
want to work from lines you need lots of control points well
distributed over the whole image. Linefind is quite a new tool, and it
may just not work for you. If necessary, you'll have to add manual
line control points, which isn't too hard.

> > In the optimizer tab, switch to user-defined parameters. Uncheck
> > everything apart from the values you want, probably you will want
> > v,a,b, and c - only for the TIFF made from the RAW image, while the
> > other image, which you claim to be correct, should have these set to
> > the correct fov for v and zero for a,b, and c. Then optimize.
>
> I ended up doing just this. I got a set of a-b-c parameters for 7 different
> focals, but the result is not so nice; I don't know whether the problem is
> with Hugin, or with the other programs using the LensFun database.

I can't judge that either, but again I ask you to make sure you really
have many, and well-distributed control points. If you work from
lines, a few dozen isn't too much, and if you work with point control
points in panoramas, something like a hundred per image pair is a good
idea. You may also consider not to do a,b and c (like, you could try
omit c or just optimze for b by itself for a start and this may
already be quite good). And mabe you have to include lateral shift (d
and e) to get things right.

And if you work from a panorama, try and find something which has rich
content all around, like an ornate building from the inside.

Calibration sounds straightforward in theory, but it is quite an
involved process and may take you some time to get right, and there
isn't even a guaranty your results will be as good as you'd wish them
to be. It's definitely a fair amount of work for a zoom lens. Stick
with it, and don't hesitate to come back for more help.

What system are you on?

Kay

Bruno Postle

unread,
May 20, 2012, 6:44:22 PM5/20/12
to hugin and other free panoramic software
Yes this can be done, you need to assign a 'new lens' to the TIFF
version of the photo so that Hugin knows that they will have
different lens distortion parameters.

Then in the Optimiser tab, you need to optimise nothing for the JPEG
photo, but optimise a,b,c and v (field of view) for the TIFF photo.

You can't do this using the Hugin Assistant, so you need to perform
the steps using these other Hugin tabs.

Though I have a similar camera (Lumix LX3) that applies distortion
correction to the JPEG output, it is quite good, but it isn't as
good as I can get calibrating everything in Hugin by stitching a
panorama.

--
Bruno

Marie-Noëlle Augendre

unread,
May 24, 2012, 5:05:23 AM5/24/12
to hugi...@googlegroups.com


2012/5/21 Bruno Postle <br...@postle.net>


Yes this can be done, you need to assign a 'new lens' to the TIFF version of the photo so that Hugin knows that they will have different lens distortion parameters.
 
... but it isn't as good as I can get calibrating everything in Hugin by stitching a panorama.


Thanks for your answers. I hadn't realized it involved a the stitching of several panoramas (one for each focal lens, I guess). I'm afraid I've nor time neither ability enough to do this at the moment; the Powershot S100 is only a 'notebook' camera for me, and I might wait for someone more knowledgeable on the matter to do this calibration (will stick to the JPEG in the meantime).

Marie-Noëlle
Reply all
Reply to author
Forward
0 new messages