On Thursday, April 28, 2022 at 2:33:53 AM UTC-7 [email protected] wrote:

> Lensfun and panorama tools have a slightly different lens model, so it 
> isn't always possible to transfer parameters (I'm not sure if there is 
> a converter, it wouldn't be difficult to write one if it doesn't 
> exist). 
>
> I thought the "ptlens" distortion model in lensfun was identical to 
hugin's model.  The lensfun tutorials show the a,b,c parameters from 
hugin's optimization being directly used in lensfun data.  The equations 
documented sure looks the same, but you have far, far more experience at it 
so I will look harder at it.  FWIW here's the web page I referenced 
documenting the lensfun "ptlens" model:

https://lensfun.github.io/calibration-tutorial/lens-distortion.html

The idea of optimising a merged project to get more accurate lens 
> parameters should work. There is a tool called ptomerge in the 
> Panorama::Script perl module for merging projects, I'm not sure if it 
> merges lenses, but if it doesn't you can reassign the lens in Hugin. 
>
> Oooh, thanks for that.  I'm perl fluent so that's a nice place to start.
After a little more research, I read where image stabilization could be a 
cause for the "d,e" parameters to legitimately be different for each 
image.   So I may need to link only the a,b,c parameters and allow d&e to 
be optimized for each indvidual image.

I like the idea of a 'handheld' mode for limiting translation 
> parameters, though since these parameters are unitless I'm not sure 
> how to pick the thresholds reliably. 
>

The best understanding I have is that the translation parameter units are 
relative to the panosphere, where the panosphere radius is 1.   I got that 
understanding from this page:
http://hugin.sourceforge.net/docs/manual/Stitching_a_photo-mosaic.html

I think if a "handheld" mode was to be incorporated into hugin, translation 
change limits would be set in the preferences.   I have it hard-coded with 
a maximum change of 0.05. So if the true TrX is 0.1, and the optimization 
ran "perfectly" it would take two runs of the optimizer for Trx to get to 
0.1   I also contrained the Tpy and Tpp for translation mapping plane to 
not change by more than 0.9, but I haven't optimized those so far.

If you are interested in this, I'll bundle up the changes I have in a zip 
or tar file.  As I recall 4 or 5 source code files were affected.  I did 
not attempt to get the LM starting step sizes for the parameters correctly 
set, those are hardcoded, and the same for every parameter, it's still a 
FIXME issue.

Jeff


> -- 
> Bruno 
>
> On Thu, 28 Apr 2022 at 02:34, Jeff Welty wrote: 
> > 
> > I have a new camera (Canon G1X mark iii). 
> > 
> > The default lens distortion at the widest angle (15mm) in lensfun 
> definitely does not match my particular copy of this camera, so I can't 
> export output Darktable with lens correction. 
> > 
> > I have a dozen or so mini-panoramas with 2 to 5 images each, of which I 
> can get very good distortion fits with hugin. Same projection is used for 
> all panoramas. 
> > 
> > One approach is take the average value of each coefficient from each of 
> the separate panoramas, and update the lensfun data with the average value. 
> I did a quick check and this appears mathematically consistent. 
> > 
> > Another approach, which I haven't seen in the FAQ, would be to combine 
> the panoramas algorithmically -- changing the control point numbers and 
> image numbers so they all remain unique. The panorama view would make no 
> sense, but I don't think hugin would encounter any problems with that. 
> > 
> > If I did this, I believe hugin could perform a custom optimization and 
> output a good estimate for distortion coefs based on all the panorama data 
> I have for a given focal length. Do you think this will work? 
> > 
> > On a side note -- I have yet to use a tripod, I am pretty good at 
> rotating the camera around the exit pupil. But a little translation can 
> make a big difference. I hacked in the constrained Levenberg Marquardt 
> method so the optimization doesn't get lost looking for large translation 
> parameters. This seems to be working very well. Hard coded to not let Tx,Ty 
> or Tz change more than +/- .05 from the starting value found when the 
> optimization begins. 
>
> -- 
> Bruno 
>

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/19ffb2a5-b31a-4c37-8757-22a4f104e751n%40googlegroups.com.

Reply via email to