# Hugin Batch Processor

From PanoTools.org Wiki

Batch Processor is a component of hugin that provides functionality to stitch multiple projects in a batch queue. Its goal is to make stitching of multiple projects faster. The process of stitching multiple projects is simplified using a queue of projects. User can add/edit/delete projects in the queue. The Batch Processor can also queue the creation of the final project. In this case it runs the same steps as in the Hugin Assistant tab.

Hugin Batch Processor consists of a list of projects. Projects in the list are ordered in sequential order. By default, the list is reinstated every time you open the application. What is more, entire queue of projects can be saved and reopened later using buttons Clear Batch, Open Batch, Save Batch.

# Usage

Just create several project files (do everything and just skip the export step), load them in the batch processor and start the process. This way you can run several large projects unattended. The output file name will be the same as the name of the corresponding project file (xyz.pto -> xyz.tif) and is saved in the same folder.

# Flag options

Batch process is also influenced by the following check boxes:

- overwrite always: Always(for each project) overwrite output filename if it exists. Otherwise, you will get a dialog box whether you want to overwrite files or not.
- When done: Operation to do when batch process ends. This can be closing PTBatcherGUI, shutdown the computer or suspend computer. The actual available options depends on the operating system.
- Remove finished projects: If checked successful finished projects will be automatic removed from the queue. Otherwise the items remains in the queue and the user is responsible for the queue management.
- Automatic stitch after assistant: If checked successful detected projects (projects in the assistant queue) will be added the stitching queue and will therefore automatically stitched.
- Remove finished project: Removed successful finished project from the queue.
- Verbose output: Show a verbose output for the stitching or assistant.
- Always save log: Always saves the log to disc. When disabled a log is only saved for failed projects.

# Functions

## Queue management

The management of the queue can done by the appropriate menu items or by the corresponding toolbar buttons.

- Add project files to queue
- Remove project file from queue (you need to select the project file in the list)
- The complete queue list can be saved and loaded from disc (The current active list is automatically saved at the end. You don't need to save it explicitly.)
- The complete list can be cleared.

## Item management

The single items in the queue can be modified by the buttons on the right side of the window

- Remove complete will remove all items form the queue which were successfully finished.
- Change prefix will change the output prefix. This is only possible if the item is in the stitching queue. It does not work for items in the assistant queue.
- Reset project/Reset all resets the status of the selected project/all projects to default value. This allows to execute the stitching again.
- Edit with Hugin opens the selected in Hugin to modify it.
- The order of the items can be change with Move project up and Move project down
- You can also add an arbitrary command to the queue with Add application.

## Executing queue

The queue can be started, paused/resumed and stopped with the toolbar buttons. You can also skip one project.

## Automation

PTBatcherGUI provides some more features for automation. This can be accessed by File->Search directory for.

### Existing project files

With File->Search directory for...->Projects you can search recursively in the given folder for (existing) project files and appends them to (stitching) queue.

### Image sets (create project files)

First select a folder in which PTBatcherGui should search for image sets. After pressing start it will search for image files in the folder (and optionally its sub folders). It uses the information stored in the EXIF data to decide which images could belong to a an image set forming a panorama. This works only in one folder level, it does not match images in different folders. (The algorithm uses camera maker, camera model, focal length, image size and date/time for this decision.)

After the search has finished it shows a list of the found panoramas. With Send selected panoramas to queue the project files are created and sent to the assistant queue. You can deselect individual panoramas from this processing step by untick the panorama.

The project files are named with the selected name scheme

- PanoramaXX.pto: This will generate project files: panorama0.pto, panorama1.pto,...
- First file - last file.pto: The project files will by named by the first and last image of the panorama.
- Foldername.pto: In this case the project file is named like the containing folder.
- Template from preferences: This will use the template defined in the preferences of Hugin.

Existing project files will not be overwritten, instead it appends an increasing number.

If the images are shot with auto bracketing it tries to generate the appropriate stacks. In this case check that your default control point generator setting is such that it works with stacks (check Preferences in Hugin and control point detector parameters).

On the options tab you can fine-tune the algorithm:

- Minimum number of images: This is the minimal number of images a sequence of consecutive images must have to be detected as panorama.
- Maximum time difference: The maximal time between 2 images to be detected as consecutive/related images.
- Create links: Select this option, if you shoot from a tripod. This will link the positions of all images of one stack. If you deselect this option, it will create the stacks but will not link the positions of the images (e.g. when shooting free hand).
- Load distortion data: Try to automatic load distortion data from lens database. Otherwise the distortion values are initialized to zero and will be calculated by the optimizer.
- Load vignetting data: Try to automatic load vignetting data from lens database. Otherwise the distortion values are initialized to zero and are calculated by the optimizer.

If you set the tickmark Automatic stitch after assistant, PTBatcherGui will first run the assistant on all found panoramas, thereby creating the complete project files, and then stitch all created projects.

### Generate sequence from template

The functions is useful for stitching of sequences of panoramas shooting with fixed camera-arrays, e.g. time-lapse panoramas.

First create a template pto file for the first pano/frame. Then oad this template with "Generate sequence from template" in PTBatcherGUI. It lists now all images in the template. You need to give a directory and/or image template. This should provide instruction how to generate the filenames for the other frames. For this there are 3 different counters available:

- %p is counting up for each pano, this counter determines also how many panoramas are generated.
- %i is counting up for each images in each pano and resets to 0 for each pano
- %x is a consecutive counter

For each counter the start value and the step width can be set. Also the number of digits used can be set (padding with zeros, width 4 would be 0001, 0002, ...)

Some examples (assuming template has 6 images):

a) consecutive image numbers

        pano0: img0.jpg, img1.jpg, ... , img5.jpg
        pano1: img6.jpg, img7.jpg, ..., img11.jpg
        pano2: ...

Sequence image name should be `img%x.jpg` for all images (this can be easily done by "change all images")

b) panox-y.jpg type

       pano0: pano0-0.jpg, pano0-1.jpg, ... , pano0-5.jpg
       pano1: pano1-0.jpg, pano1-1.jpg, ... , pano1-5.jpg

Sequence image name: `pano%p-%i.jpg`

c) subdirectory for each pano

       pano0: pano0/img_0.jpg, pano0/img_1.jpg, .. , pano0/img_5.jpg
       pano1: pano1/img_0.jpg, pano1/img_1.jpg, .. , pano1/img_5.jpg

Directory template: `pano%p` (if no other sub-directories exits you can also use the option "iterate all sub-directories")

Sequence image name: `img_%i.jpg`

d) sub-directory for each individual camera (assuming 3 cameras)

       pano0: left/0.jpg, center/0.jpg, right/0.jpg
       pano1: left/1.jpg, center/1.jpg, right/1.jpg

Sequence image names:

- for first image: `left/%p.jpg`
- for second image: `center/%p.jpg`
- for third image: `right/%p.jpg`

All paths are relative to the given base path. By default this is the path of the template pto file. But this can be changed. The generated pto files are saved in the base path.

By pressing "Generate preview" you can generate the file list for the current settings. If it matches your folder/file structure then press "Generate assistant/stitching sequence". This will generate all pto files and add them to PTBatcherGUI queue. The filenames of the generated pto files can be chosen with the different naming choices in the dialog (see section "Image sets" above for more details).

# Command line switches

To add a project to the (stitching) queue use

       PTBatcherGUI project.pto output_prefix

on Mac OS X use

       open PTBatcherGui.app --args project.pto output_prefix

You can also add several projects

       PTBatcherGUI project1.pto prefix1 project2.pto prefix2

on Mac OS X use

       open PTBatcherGui.app --args project1.pto prefix1 project2.pto prefix2

The prefix is optionally. If you don't provide a prefix, the filename (without extension) of the project file is used as prefix.

You can also add a project to the assistant queue.

       PTBatcherGUI --assistant project.pto

and on Mac OS X

       open PTBatcherGui.app --args --assistant project.pto

Some of the above described options can be accessed also by command line switches:

- `/h, --help` show this help message
- `/b, --batch` run batch immediately
- `/d, --delete` delete *.pto files after stitching
- `/o, --overwrite` overwrite previous files without asking
- `/s, --shutdown` shutdown computer after batch is complete
- `/v, --verbose` show verbose output when processing projects
- `/a, --assistant` run the assistant on the given projects
- `/u, --user-defined=<str>` use the given user defined sequence for the specified projects

Please keep in mind that only one instance of PTBatcherGUI can run at one time. Starting PTBatcherGUI a second time with command line switches will influence the already running instance and not start a second instance with own options.

Retrieved from "https://wiki.panotools.org/index.php?title=Hugin_Batch_Processor&oldid=17406"