Creating multiple panoramas from a .bat file

226 views
Skip to first unread message

Gitominoti

unread,
Dec 5, 2011, 3:23:55 PM12/5/11
to hugin and other free panoramic software
So I'm trying to create several panoramas that are 3 pictures each
from a .bat file. I've so far found very little tutorials, besides the
one that is on the PanoTools Wiki page. I have Hugin, and I have
downloaded autopano-sift-2.3. I created a .bat file from the wiki
page, but the file isn't being made (or if it is, I don't know where
it is saving it) Here is everything that is in the file:

autopano-sift --projection 0,50 test.pto folder1/pic.JPG folder2/
pic.JPG folder3/pic.JPG
celeste_standalone -i test.pto -o test.pto
autooptimiser -a -l -s -m -o test.pto test.pto
enblend -o test.jpg test0000.jpg test0001.jpg test0002.jpg ...

I have all of the files from the bin folder from Hugin, along with
this batch file and the folders that contain the photos, all in one
folder (but Autopano-sift has its own folder that has tons of files in
it). Why doesn't this work? Any help wold be great.

Also, is there a way to do batch cropping? I want to crop all of my
photos to the same size so you don't see any black.

Thanks

Gitominoti

unread,
Dec 5, 2011, 3:49:04 PM12/5/11
to hugin and other free panoramic software
Actually, I'm using CPFind to make the control points instead of
autopano-sift

Bruno Postle

unread,
Dec 5, 2011, 3:55:43 PM12/5/11
to hugin and other free panoramic software
On Mon 05-Dec-2011 at 12:23 -0800, Gitominoti wrote:
>So I'm trying to create several panoramas that are 3 pictures each
>from a .bat file. I've so far found very little tutorials, besides the
>one that is on the PanoTools Wiki page. I have Hugin, and I have
>downloaded autopano-sift-2.3. I created a .bat file from the wiki
>page, but the file isn't being made (or if it is, I don't know where
>it is saving it) Here is everything that is in the file:
>
>autopano-sift --projection 0,50 test.pto folder1/pic.JPG folder2/pic.JPG folder3/pic.JPG

>celeste_standalone -i test.pto -o test.pto
>autooptimiser -a -l -s -m -o test.pto test.pto
>enblend -o test.jpg test0000.jpg test0001.jpg test0002.jpg ...

The way to test it is to run the commands one at a time on the
command-line and see what happens at each stage.

If you use cpfind you don't need to run celeste_standalone, since
there is now a cpfind --celeste option.

>Also, is there a way to do batch cropping? I want to crop all of my
>photos to the same size so you don't see any black.

You can do this with the pano_modify tool.

--
Bruno

Gitominoti

unread,
Dec 5, 2011, 4:22:54 PM12/5/11
to hugin and other free panoramic software
Okay so do I run these lines in cmd to test them? When I run them
right now by double clicking the .bat file, a cmd pops up, runs
through so code so fast I can't read it, then it closes. I have no
idea what it is doing. When I type it into a cmd, it says that the
command is unknown, or something along those lines

I'm new to batch files, so sorry if these are dumb questions

Frederic Da Vitoria

unread,
Dec 5, 2011, 5:16:57 PM12/5/11
to hugi...@googlegroups.com
2011/12/5 Gitominoti <gitom...@gmail.com>

You can insert a "pause" (without the quotes) after each command. When it reaches each "pause", the .bat will wait until you press a key so you will have the time to see the output. But you won't be able to scroll if the output is larger than your screen's length, you'll only see the last part of the output. So if you want to inspect all the results, you'll have to use a redirect command (I'm not sure it works with Hugin's sets of tools but I have a hunch it does) with the ">" operator. Or maybe the Hugin tools offer a switch to log the output to a file?

--
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org

kfj

unread,
Dec 6, 2011, 3:04:48 AM12/6/11
to hugin and other free panoramic software
On 5 Dez., 21:23, Gitominoti <gitomin...@gmail.com> wrote:

> autopano-sift --projection 0,50 test.pto folder1/pic.JPG folder2/
> pic.JPG folder3/pic.JPG
> celeste_standalone -i test.pto -o test.pto
> autooptimiser -a -l -s -m -o test.pto test.pto

hang on... I think you're missing something right here. The commands
so far create the pto and optimize the image positions to fit the
control points. But you haven't got the 'warped' images yet. You need
a call to nona with the optimized pto to produce the images
test0000.jpg etc. - with a call like

nona -o test test.pto

once you have them you can proceed to the next step and call enblend:

> enblend -o test.jpg test0000.jpg test0001.jpg test0002.jpg ...

Kay

Gitominoti

unread,
Dec 7, 2011, 2:11:52 PM12/7/11
to hugin and other free panoramic software
So I found that the command for cpfind --celeste is

cpfind --celeste -o test.pto test.pto

and the pano_modify code is this

pano_modify -c --crop=AUTO --output=test.pto test.pto

But that doesn't say where to find the photos that you want in the
panorama. My entire code is now:

cpfind --celeste -o test.pto test.pto
autooptimiser -a -l -s -o test.pto test.pto
nona -o test test.pto
enblend -o test.tif test0000.tif test0001.tif test0002.tif ...
pano_modify -c --crop=AUTO --output=test.pto test.pto

I ran this, and I got these errors

HuginBase::Panorama::readData(): Failed to read from dataInput. ERROR:
couldn't parse panos tool script: 'test.pto'!

autoptimiser -a-l-s-o test.pto test.pto could not open script :
test.pto

HuginBase::Panorama::readData(): Failed to read from dataInput. ERROR:
couldn't parse panos tool script: 'test.pto'!

enblend: no input files specified

pano_modify -c --crop=AUTO --output=test.pto test.pto could not open
script : test.pto

I'm guessing that because they all mention input, that it is becauseI
don't specify where to get the pictures from

Bruno Postle

unread,
Dec 7, 2011, 3:24:00 PM12/7/11
to hugin and other free panoramic software
On Wed 07-Dec-2011 at 11:11 -0800, Gitominoti wrote:
>So I found that the command for cpfind --celeste is
>
>cpfind --celeste -o test.pto test.pto

>HuginBase::Panorama::readData(): Failed to read from dataInput. ERROR:


>couldn't parse panos tool script: 'test.pto'!

>I'm guessing that because they all mention input, that it is becauseI


>don't specify where to get the pictures from

Yes, cpfind (unlike autopano-sift-c) expects to get the list of
input photos from an existing .pto project.

You can create this project in several ways:

* Save a Hugin project and use it as a template. Either edit it to
suit the filenames of the photos, or just rename your files to suit
the names in the project file.

* Use match-n-shift to generate the project from the filenames, this
requires a perl installation.

* Use a Hugin snapshot from today (i.e. from the 'tip' not the
upcoming 2011.4 release), Thomas has added a new tool called
'pto_gen' that replaces match-n-shift, so you don't need to have
perl.

--
Bruno

Gitominoti

unread,
Dec 7, 2011, 3:45:48 PM12/7/11
to hugin and other free panoramic software
Thank you very much. For those who also didn't know how to make one, I
used the code from above

cpfind --celeste -o test.pto test.pto

autooptimiser -a -l -s -o test.pto test.pto
nona -o test test.pto
enblend -o test.tif test0000.tif test0001.tif test0002.tif ...
pano_modify -c --crop=AUTO --output=test.pto test.pto

When into the Hugin GUI, and made a panorama. I took the .pto and
saved it in the folder with the .bat. Ran it, and it worked.

One question though. I see that it also spits out 3 other images
(test0000.tif, test0001.tif and test0002.tif) They aren't needed since
they are just the individual warped sections of the panorama. How can
I stop it from making these files? I'm see that it is enblend that is
doing it. Do I just need another line using the DEL command, or is
there a way to stop it without having it do that?

Bruno Postle

unread,
Dec 7, 2011, 4:04:22 PM12/7/11
to hugin and other free panoramic software
On Wed 07-Dec-2011 at 12:45 -0800, Gitominoti wrote:
>
>One question though. I see that it also spits out 3 other images
>(test0000.tif, test0001.tif and test0002.tif) They aren't needed since
>they are just the individual warped sections of the panorama. How can
>I stop it from making these files? I'm see that it is enblend that is
>doing it.

These are created by nona, and are used as input by enblend. You
can delete them after the enblend stage.

--
Bruno

Gitominoti

unread,
Dec 9, 2011, 2:09:34 PM12/9/11
to hugin and other free panoramic software
One last question. I have to use match-n-shift to make my .pto
templates so that I can specify what photos need to be in the
panorama. I found that to call it you need:

match-n-shift [options] --output project.pto image1 image2 [...]

So for my code (with the images in separate folders), I have this
code:

match-n-shift --output test.pto folder1/1.jpg folder2/1.jpg folder3/
jpg

However, I get a lot of errors.

'generatekeys' is not recognized as an internal or external command,
operable program or batch file.
^ is repeated 3 times
'autopano' is not recognized as an internal or external command,
operable program or batch file.

Use of unintialized value in division (/) at loader /loader/0x1471490/
match-n-shift.pl line 168
^ repeated dozens of times for several other lines

Do I have the right match-n-shift? Or am I calling it wrong? You say I
have to have Perl. Te place that I downloaded match-n-shift from came
with a file called perl58.dll. Is that all I need, or is there
something else?

Thanks

Gitominoti

unread,
Dec 9, 2011, 3:14:25 PM12/9/11
to hugin and other free panoramic software
Actually, the line should be

match-n-shift -o test.pto folder1/1.jpg folder2/1.jpg folder3/1.jpg

I've even tried taking the picture out of the folders, but that didn't
work either.

Bruno Postle

unread,
Dec 9, 2011, 5:24:06 PM12/9/11
to hugin and other free panoramic software
On Fri 09-Dec-2011 at 11:09 -0800, Gitominoti wrote:
>
>Do I have the right match-n-shift? Or am I calling it wrong? You say I
>have to have Perl.

This is an ancient match-n-shift (it runs some tools from
autopano-sift-c directly). There was a current Windows version
of all the Panotools::Script tools posted to this list recently.

--
Bruno

Gitominoti

unread,
Dec 9, 2011, 7:53:02 PM12/9/11
to hugin and other free panoramic software
Where can I find it then? I downloaded the one at your cpan (http://
search.cpan.org/dist/Panotools-Script/bin/match-n-shift), but all of
the files included in the bin folder are .file types (and not .exe so
I can't open/use them). The one I'm using now is from here:
http://www.panoguide.com/forums/qna/4942/ . I'm having a really hard
time just trying to track down the .exe's for any of the plugins that
are mentioned in the wiki, let alone find good documentation for them.
Even that pto_gen file you mentioned, is nowhere to be found.

I was fiddling around with what I had earlier today, and I got it to
work somewhat (not really). It recognized the pictures, but it
destroyed the panorama (completely distorted it, some parts were
flipped and it wouldn't crop properly). I also still needed to keep
a .pto file that I had made in Hugin in the folder with the .bat file
so it wouldn't crash.

Again, thanks for the help

Harry van der Wolf

unread,
Dec 10, 2011, 6:52:19 AM12/10/11
to hugi...@googlegroups.com
Why not use PTBatcherGui for bulk processing of several sets of panorama images? You use a batch file for multi-pano automation but PTBatcherGui can do the same.

Take a look at http://wiki.panotools.org/Hugin_Batch_Processor#Automation

Note: Until quite recently (don't ask me a specific time frame) this did not always work correctly.*
In an off-group mail exchange about gen_pto Thomas told me that all current PTBatcherGui versions do it correctly. This function is most helpful.
(Thanks Thomas for this tip).

I myself just dumped 7 sets of images in a folder and let PTBatcherGui did the job. Only one set, containing incorrect exif-info, was not detected. The others were all detected. PTO's were created (for finetuning in Hugin) and if you check the "Automatic Stitch after Assistant"  it will even create the panos for you.

Harry

*: I did try it a couple of times in the past year without much succes. Now it works great.

Gitominoti

unread,
Dec 10, 2011, 7:05:55 PM12/10/11
to hugin and other free panoramic software
I have thousands of images that I need turned into panoramas, so it
will take a lot of processing power. If I can use a .bat file, I can
time it so it processes through the images at, let's say, 2am

On Dec 10, 6:52 am, Harry van der Wolf <hvdw...@gmail.com> wrote:
> Why not use PTBatcherGui for bulk processing of several sets of panorama
> images? You use a batch file for multi-pano automation but PTBatcherGui can
> do the same.
>

> Take a look athttp://wiki.panotools.org/Hugin_Batch_Processor#Automation

Gitominoti

unread,
Dec 12, 2011, 4:03:41 PM12/12/11
to hugin and other free panoramic software
Could someone please post a link to where I can find pto_gen? I've
looked everywhere, but I can't find it. I've downloaded match-n-shift
from the SouceForge site, but it is warping the panorama.

Thanks

Harry van der Wolf

unread,
Dec 12, 2011, 5:01:39 PM12/12/11
to hugi...@googlegroups.com


2011/12/12 Gitominoti <gitom...@gmail.com>

You need a very recent development build of Hugin. I think there is no such a build yet for windows.
You could try to build it yourself.

Harry

Terry Duell

unread,
Dec 12, 2011, 5:04:08 PM12/12/11
to hugi...@googlegroups.com
On Tue, 13 Dec 2011 08:03:41 +1100, Gitominoti <gitom...@gmail.com>
wrote:

> Could someone please post a link to where I can find pto_gen? I've
> looked everywhere, but I can't find it. I've downloaded match-n-shift
> from the SouceForge site, but it is warping the panorama.

pto_gen was only recently added to the hugin source. You will need to
build the latest default branch if you can't get hold of a built version.

Cheers,
--
Regards,
Terry Duell

Gitominoti

unread,
Dec 14, 2011, 11:44:10 AM12/14/11
to hugin and other free panoramic software
Okay then. What is the default code that Hugin is running if I use the
GUI? If I just load 3 pictures in it, use 50 as the default and click
create panorama, it makes a seamless photo. What plugins is it using
to do this?

Bruno Postle

unread,
Dec 15, 2011, 6:11:10 PM12/15/11
to hugin and other free panoramic software

It is using the equivalent of pto_gen, cpfind, celeste_standalone,
linefind, cpclean, autooptimiser, vig_optimize, pano_modify, pto2mk,
nona and enblend (not necessarily in that order), note that the
cpfind command-line tool now includes celeste functionality and
autooptimiser includes vig_optimize functionality.

--
Bruno

Gitominoti

unread,
Dec 15, 2011, 10:01:54 PM12/15/11
to hugin and other free panoramic software
Does the order matter? I'm using all of the ones you listed minus
pto_gen (because I can't find an .exe) and pto2mk. What exactly does
pto2mk do? I'm reading the Wiki right now and it is rather confusing.
For example, what would this line do:

pto2mk -o myproject.pto.mk -p myproject myproject.pto

Naked Robot

unread,
Dec 16, 2011, 7:33:57 AM12/16/11
to hugi...@googlegroups.com

so where is it doing the exposure + white balance optimization?

Gitominoti

unread,
Dec 16, 2011, 4:35:00 PM12/16/11
to hugin and other free panoramic software
If it came down to it, I could use this. However, when I run the
processor, it says that there are no possible matches. Would there be
something wrong with the exif data? If there is, how can I fix it? I
have all of the images in one folder (and not in separate sub folders)

On Dec 10, 6:52 am, Harry van der Wolf <hvdw...@gmail.com> wrote:

> Why not use PTBatcherGui for bulk processing of several sets of panorama
> images? You use a batch file for multi-pano automation but PTBatcherGui can
> do the same.
>

> Take a look athttp://wiki.panotools.org/Hugin_Batch_Processor#Automation

Bruno Postle

unread,
Dec 16, 2011, 7:38:20 PM12/16/11
to Hugin ptx
On Fri 16-Dec-2011 at 04:33 -0800, Jeffrey Martin wrote:
>
>so where is it doing the exposure + white balance optimization?

Each of these tools is documented:
http://wiki.panotools.org/Vig_optimize
http://wiki.panotools.org/Autooptimiser

--
Bruno

Reply all
Reply to author
Forward
0 new messages