Which optimizer to use on command line? (in looping script)

106 views
Skip to first unread message

Alister Ling

unread,
Feb 2, 2018, 6:51:53 PM2/2/18
to hugin and other free panoramic software
Hi, which optimizer do I call on the command-line, how and when? Within hugin gui, I can optimize view, barrel, position and it comes out beautifully and generates a pto file. I have read through "https://wiki.panotools.org/Panorama_scripting_in_a_nutshell" but still don't understand how to quite put it together.

It looks like I should call optimizer before nona; but I already have a pto file with all the parameters made from my manual execution of hugin. But in the nona documentation it says it ignores the optimisation lines in the pto file. So I am confused and would appreciate some pointers.

In the loop below, the optimizer does not get called, and I end up with double stars in my sky (that's why I need your help!). In my manual production I have 7 control points between each pair and it stitches nicely.

I am using a script to loop several hundred triplets using nona and enfuse (here in pseudo-code)

for Cam triplets do 
    collect triplets into a directory with the pto;
    call nona and enfuse
 
          com1 = E:\\bin\\nona -m TIFF_m -o Zenith ZenithProc.pto Cam0.tif Cam1.tif Cam2.tif;
   
          com2 = E:\\bin\\enfuse --output=Zenith.tif Zenith0000.tif Zenith0001.tif Zenith0002.tif;
 
    move zenith.tif to final directory
      
endfor

Do I make a call with PToptimizer or autooptimiser? where in the above sequence? Since I already have done the optimizing manually in the gui, can I simply re-use the calculated parameters?

Thanks,
Alister.

T. Modes

unread,
Feb 3, 2018, 4:01:23 AM2/3/18
to hugin and other free panoramic software


Am Samstag, 3. Februar 2018 00:51:53 UTC+1 schrieb Alister Ling:
Hi, which optimizer do I call on the command-line,
Use autooptimiser (PTOptimiser does not understand all advanced options in the Hugin project file).

how and when?
You call it, when you changed control points and want to calculate the new positions based on the changed control points.
The optimiser takes only the control points into account (but not the image content). It tries to find the solution (=a set of image positions and lens parameters) where the error of all control points is minimal.
(Nona is then using this solution to do the remapping of the images, nona does not calculate these positions).

A slightly long description: Each control point is connected with 2 images, so you get 2 positions in the panorama (with the current image positions). Ideally these 2 positions would be identical, practically they have same displacement - this is the control point error.
The optimiser starts with the current image positions in the pto file. It calculated the control point error for all control points. Then the optimiser changes the image positions (and lens parameters) a little and calculate the control point errors again (this is one iteration, as displayed in the progress window or the console).
If there average error is reduced with the new positions it changes the image positions further in this direction. If the average error becomes bigger with the new positions it changes the parameters in the other direction. (This is a simplified description of the algorithm). This is done until the average error does not decrease further.
 
It looks like I should call optimizer before nona; but I already have a pto file with all the parameters made from my manual execution of hugin. But in the nona documentation it says it ignores the optimisation lines in the pto file. So I am confused and would appreciate some pointers.

In the loop below, the optimizer does not get called, and I end up with double stars in my sky (that's why I need your help!). In my manual production I have 7 control points between each pair and it stitches nicely.

I am using a script to loop several hundred triplets using nona and enfuse (here in pseudo-code)
When you exchange only the image in the project file (as shown in your pseudo-code) without modifying control points/adding new control points there is no point in executing autooptimiser.
The control points are the same, so the result of the autooptimiser is the nearly same as before (beside some little numeric error).

Thomas

Alister Ling

unread,
Feb 9, 2018, 1:52:23 AM2/9/18
to hugi...@googlegroups.com
It works nicely! Thank you so much. I will post a link to a small tutorial on this in a couple of days.
The first one of the sequence I do manually and save to  ZenithProc_preop.pto .
Then I run the loop where the output of the optimiser ( -o ZenithProc.pto ) becomes input to nona

        $com = "E:\\bin\\autooptimiser.exe -q -n -o ZenithProc.pto ZenithProc_preop.pto ";
        # part1 pano:
        $com = "E:\\bin\\nona -m TIFF_m -o Zenith ZenithProc.pto Cam0.tif Cam1.tif Cam2.tif";
       # part 2 : enfuse/blend
        $com = "E:\\bin\\enfuse --output=Zenith.tif Zenith0000.tif Zenith0001.tif Zenith0002.tif 2> PROC_ERR.txt";

The autooptimiser runs quite quickly. 
Now to let the 1500 triplets process overnight. 
Regards,
Alister.

--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to a topic in the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hugin-ptx/JDBA5gKLA68/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hugin-ptx+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/2f7c864a-bbf0-4750-93ca-85565eb16de5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

T. Modes

unread,
Feb 9, 2018, 9:42:13 AM2/9/18
to hugin and other free panoramic software


Am Freitag, 9. Februar 2018 07:52:23 UTC+1 schrieb Alister Ling:
It works nicely! Thank you so much.
Sorry, but you missed the point. Please reread my post again.
Cite:

>> When you exchange only the image in the project file (as shown in your pseudo-code) without
>> modifying control points/adding new control points there is no point in executing autooptimiser.
>> The control points are the same, so the result of the autooptimiser is the nearly same as
>> before (beside some little numeric error).

The first one of the sequence I do manually and save to  ZenithProc_preop.pto .
Then I run the loop where the output of the optimiser ( -o ZenithProc.pto ) becomes input to nona

        $com = "E:\\bin\\autooptimiser.exe -q -n -o ZenithProc.pto ZenithProc_preop.pto ";
        # part1 pano:
        $com = "E:\\bin\\nona -m TIFF_m -o Zenith ZenithProc.pto Cam0.tif Cam1.tif Cam2.tif";
       # part 2 : enfuse/blend
        $com = "E:\\bin\\enfuse --output=Zenith.tif Zenith0000.tif Zenith0001.tif Zenith0002.tif 2> PROC_ERR.txt";
This corresponds to loading ZenithProc.preop.pto in Hugin GUI, pressing optimize, then save again (and this 1500 times). Then you replace the images and remap the images and fused them. 

The autooptimiser runs quite quickly.
Now to let the 1500 triplets process overnight. 
 You run autooptimiser for each triplet on the same input and so you will get always (nearly) the same output (because you don't change the control points)
So if you have a lot of time and want to heat your home...

Alister Ling

unread,
Feb 28, 2018, 1:11:29 AM2/28/18
to hugin and other free panoramic software
Thomas, thank you! I apologize for being so late in posting a note of appreciation - now that I have some better perspective, I see that (of course) you were right about the pointless reruns of the optimizer. I have completed the entire 3100+ frame movie, but I can only release a "teaser" to the public:
I will soon be building a web page showing more explicitly the steps I took (a tutorial). I am looking forward to showing this on the upgraded planetarium later this year - I need to give them 8000x8000 images so the system can process and show it. Hugin is grinding away at it nicely.

Regards, and a deep bow to you,
Alister.
Zenith_2205.JPG
Reply all
Reply to author
Forward
0 new messages