# Vig optimize

From PanoTools.org Wiki

Photometric parameters such as exposure (EV), vignetting, white balance[*] and camera response curve can be optimised by Hugin in a similar way to lens distortion. These photometric parameters can be edited in the Photos tab or calculated automatically in the Exposure tab.

For this to work, photos first have to be aligned with correct relative positions and lens parameters. Hugin will compare randomly selected groups of pixels from matching areas in each of the overlapping photos. Exposure and response curve can be calculated with any kind of overlap, however vignetting calculations require partial overlap, ideally around 50%.

As well as the GUI process of optimisation/calculation in the hugin Exposure tab, photometric calculation can also be performed on the command-line with the vig_optimize tool. This functionally is configured via 'v' variable lines in the .pto project file in a similar way to the autooptimiser tool:

- The camera response curve is simplified using the EMoR[*] sensor model which reduces the variation to five numbers, these are the Ra, Rb, Rc, Rd & Re image (i) parameters (the default values of 0.0 are equivalent to an 'average' generic sensor).
- The vignetting model is represented by a polynomial with four parameters: Va (this is always 1.0 and doesn't need to be optimised) and Vb, Vc & Vd (which default to 0.0 - equivalent to no vignetting). The vignetting centre can also be different from the geometrical centre, this is specified by Vx & Vy (both default to 0.0).
- Exposure (EV) is represented by a single value Eev (defaults 0.0, equivalent to no-change).
- The white balance[*] is represented by multipliers for the red and blue channels Er and Eb (the defaults of 1.0 are equivalent to no-change).

A typical 'v' variable line configuration would look like this, i.e. optimise camera response curve and vignetting for image 0 and exposure for images 1, 2, 3 and 4:

    v Ra0 Rb0 Rc0 Rd0 Re0 Vb0 Vc0 Vd0
    v Eev1 Eev2 Eev3 Eev4

(vignetting centre and white balance are left unchanged)

The .pto project itself can then be optimised with vig_optimize on the command-line like so:

     vig_optimize -o myproject.pto myproject.pto

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