Optimizer GUI x Script

85 views
Skip to first unread message

LF Martins

unread,
May 28, 2020, 8:42:40 PM5/28/20
to hugin and other free panoramic software
Hello, it is me again.

After my previous post was hijacked, I made more tests and definitely optimizing using the GUI isn't the same as using autooptmizer -n in a script.

To test this, I have added three images to Hugin via GUI, used it to find the control points, cleaned them, then configure it to Optimize Geometric Custom Parameters. After that I opened Optimizer tab and selected only y, p, r, TrX, TrY and TrZ for each image, then selected only two images: the first one (anchor) and second one, then saved the project as test_hugin.pto. I then run Optimize in GUI and using autooptimizer and the results are:

GUI
#-hugin  cropFactor=1
i w640 h480 f0 v50
Ra0 Rb0 Rc0 Rd0 Re0 Eev0 Er1 Eb1 r0 p0 y0 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a0 b0 c0 d0 e0 g0 t0 Va1 Vb0 Vc0 Vd0 Vx0 Vy0  Vm5 n"01_image.png"
#-hugin  cropFactor=1
i w640 h480 f0 v
=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev0 Er1 Eb1 r0.57358464596854 p-9.21762588878221 y-1.94167450388466 TrX0.00797698982600632 TrY-0.222427372643953 TrZ0.718060094751586 Tpy0 Tpp0 j0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0  Vm5 n"02_image.png"
#-hugin  cropFactor=1 disabled
i w640 h480 f0 v
=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev0 Er1 Eb1 r0 p0 y0 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0  Vm5 n"03_image.png"


autooptimizer
#-hugin  cropFactor=1
i w640 h480 f0 v50
Ra0 Rb0 Rc0 Rd0 Re0 Eev0 Er1 Eb1 r0 p0 y0 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a0 b0 c0 d0 e0 g0 t0 Va1 Vb0 Vc0 Vd0 Vx0 Vy0  Vm5 n"01_image.png"
#-hugin  cropFactor=1
i w640 h480 f0 v
=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev0 Er1 Eb1 r0.112022825895375 p-11.0039359572305 y2.21797983590819 TrX-0.116826162066902 TrY-0.277050212214271 TrZ0.72073808058671 Tpy0 Tpp0 j0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0  Vm5 n"02_image.png"
#-hugin  cropFactor=1 disabled
i w640 h480 f0 v
=0 Ra=0 Rb=0 Rc=0 Rd=0 Re=0 Eev0 Er1 Eb1 r0.0225130795756708 p0.213684689971728 y0.023375441332762 TrX-0.000608701446789677 TrY0.00351750071573924 TrZ-0.000714185704715796 Tpy0 Tpp0 j0 a=0 b=0 c=0 d=0 e=0 g=0 t=0 Va=0 Vb=0 Vc=0 Vd=0 Vx=0 Vy=0  Vm5 n"03_image.png"



As it clear, the values for the second image is very different:

GUI
r0.57358464596854 p-9.21762588878221 y-1.94167450388466 TrX0.00797698982600632 TrY-0.222427372643953 TrZ0.718060094751586 

autooptimizer
r0.112022825895375 p-11.0039359572305 y2.21797983590819 TrX-0.116826162066902 TrY-0.277050212214271 TrZ0.72073808058671

and it happens even if in the project sets the optimization as only:
# specify variables that should be optimized
v r1
v p1
v y1
v
TrX1
v
TrY1
v
TrZ1



It is also clear the autooptimizer does not respect the "disabled" tag for the third image. This means the GUI uses something else to do the optimization?

Is it a known bug? If yes, is it planned to be fixed?

Also, is there are way that I can use the same optimization done in GUI for a script? How?

Side question: how do add and remove the "disable" tag in a batch script?

I have added all flies (images and project files) to a shared folder in Google Drive, if anyone wants to check them.

I do appreciate any help here. I need to do this to thousands of images, and Hugin is the only option I have found. And I know it works, but it is not working using the command line tools in a script. I simply need to align some images and then crop them to the same size. Using the GUI, it works perfectly, but I tried many combinations using a script and it didn't work. And I am sure there is a problem with the autooptimizer tool, If someone knows how to fix it, please let me know. Maybe this would work with the Perl tools instead of the simple command line tools?

By the way, I am using Pop!_OS 20.04 (same as Ubuntu 20.04) and the Hugin version is: 2019.2.0.b690aa0334b5.

Best regrads,
LFOM

Carlos Eduardo G. Carvalho (Cartola)

unread,
May 29, 2020, 2:24:52 PM5/29/20
to hugi...@googlegroups.com
Hi LF,

the reason for samples it that I would be able to understand better what your intention is and maybe could be able to suggest alternatives. I'm not a developer, maybe someone could explain better how hugin deals with translation optimization, but I were never, really never able to use it with good results. From what you say I imagine that using the GUI it is working. I have already tested translation in PTGui and it worked as I expected: I was able to join a displaced nadir picture in a full sphere panorama. 

Well, a possible workaround to this image set you sent is using different lenses for different images instead of translation. This will work only if the translation is like this: getting closer or away from subject. This way you can avoid translation and optimize only other parameters.
Here are the optimization steps I've already used to stitch full sphere panoramas. They ran after all the process of finding CPs on image pairs, vertical lines and so on.

pto_var --opt y,p,r -o final.pto final.pto
autooptimiser -n -o final.pto final.pto

pto_var --opt y,p,r,v -o final.pto final.pto
autooptimiser -n -o final.pto final.pto

pto_var --opt y,p,r,v,b -o final.pto final.pto
autooptimiser -n -o final.pto final.pto

pto_var --opt y,p,r,v,a,b,c,d,e,g,t -o final.pto final.pto
autooptimiser -n -o final.pto final.pto

Bests,


--
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 hugin-ptx+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/033fc457-888f-44a8-a763-ed6933f244dd%40googlegroups.com.

T. Modes

unread,
May 30, 2020, 4:41:47 AM5/30/20
to hugin and other free panoramic software
Hi,

that are a lot of questions...

Am Freitag, 29. Mai 2020 02:42:40 UTC+2 schrieb LF Martins:

and it happens even if in the project sets the optimization as only:
# specify variables that should be optimized
v r1
v p1
v y1
v
TrX1
v
TrY1
v
TrZ1


This I can't reproduced. When only the variables of the second images are marked for optimisation, then only the variables of second images are modified.

It is also clear the autooptimizer does not respect the "disabled" tag for the third image. This means the GUI uses something else to do the optimization?

Is it a known bug? If yes, is it planned to be fixed?
Optimisation of only active images is a feature of the GUI. This was not yet ported to the command line tool. So I would not call it a bug, instead it is a missing feature ;-)

I implemented this feature for autooptimiser in the default repository. So now the active state of the images is respected when additional specifying the switch --only-active-images. So the new behaviour is backward compatible to the old behaviour.

Side question: how do add and remove the "disable" tag in a batch script?
pto_var --enable-image=.. --disable-image=..
(added last week)

Thomas

LF Martins

unread,
May 30, 2020, 10:19:56 AM5/30/20
to hugi...@googlegroups.com
Hi, Thomas.

Thanks a lot for your reply. I know how is to work in a free software, all the questions about something not working, that's why I tried to give as much info as I could.
On 30 May 2020 05:41 -0300, T. Modes <Thomas...@gmx.de>, wrote:
Hi,

that are a lot of questions...

Am Freitag, 29. Mai 2020 02:42:40 UTC+2 schrieb LF Martins:

and it happens even if in the project sets the optimization as only:
# specify variables that should be optimized
v r1
v p1
v y1
v
TrX1
v
TrY1
v
TrZ1


This I can't reproduced. When only the variables of the second images are marked for optimisation, then only the variables of second images are modified. 

No, I meant that even if only one image is set to be optimized using pt_var, the values differ a lot. Especially if there are more than two images. If you use my project you will see that if only the second (after the anchor) is optimized using autooptimiser -n, and then only the third, the resulted values are way different then doing this with the GUI. 

It is also clear the autooptimizer does not respect the "disabled" tag for the third image. This means the GUI uses something else to do the optimization?

Is it a known bug? If yes, is it planned to be fixed?
Optimisation of only active images is a feature of the GUI. This was not yet ported to the command line tool. So I would not call it a bug, instead it is a missing feature ;-)

I implemented this feature for autooptimiser in the default repository. So now the active state of the images is respected when additional specifying the switch --only-active-images. So the new behaviour is backward compatible to the old behaviour.

Side question: how do add and remove the "disable" tag in a batch script?
pto_var --enable-image=.. --disable-image=..
(added last week) 

I do appreciate the changes, thank you a lot. But is there any any to reproduce the GUI behavior (meaning the resulting optimized values are the same) now?

Best regards,
LFOM

T. Modes

unread,
May 30, 2020, 10:49:07 AM5/30/20
to hugin and other free panoramic software
Hi,


Am Samstag, 30. Mai 2020 16:19:56 UTC+2 schrieb LF Martins:
This I can't reproduced. When only the variables of the second images are marked for optimisation, then only the variables of second images are modified. 

No, I meant that even if only one image is set to be optimized using pt_var, the values differ a lot. Especially if there are more than two images. If you use my project you will see that if only the second (after the anchor) is optimized using autooptimiser -n, and then only the third, the resulted values are way different then doing this with the GUI. 

This is a side effect of optimising all images. Then also the control points of the disabled images are active.
You have control points between all image pairs: 0-1, 1-2 and 0-2. So you have different constraints for image 1 (match to image 0 and to image 2).
When you only optimise image 1, the optimiser have to find a solution with suits both constraints.
This solution is different if only one constraint is active - like image 2 disabled and option "optimise only active images" active.

I do appreciate the changes, thank you a lot. But is there any any to reproduce the GUI behaviour (meaning the resulting optimized values are the same) now?

With the new switch the command line "autooptimiser -n --only-active-images" should behave the same way as the GUI with option "optimise only active images" active.

Thomas

LF Martins

unread,
May 30, 2020, 12:07:00 PM5/30/20
to hugi...@googlegroups.com
Thomas and Group,

Thank you a lot again. I have never used mercurial but I think I am able to download the source and build it. I didn't find any instructions about the bike process but I remember seeing a recent post here in the group about it. I will try to get a new build as soon as possible.

Best regards,
LFOM
Reply all
Reply to author
Forward
0 new messages