# Tca correct

From PanoTools.org Wiki

tca_correct is a command-line tool shipped with hugin that can be used to automatically calculate lens chromatic aberration[*] correction parameters. Ideal sample photos would have a lot of contrast over the entire image area, little saturated colour and no blown highlights.

## Using with fulla

fulla is a command-line tool for correcting lens distortion, vignetting and TCA[*] (chromatic aberration). It is capable of applying the full panotools polynomial to the red and blue channels, thereby correcting any transverse chromatic aberration.

First calculate some TCA correction parameters for a sample image, notice that I'm only going to bother optimising b and v parameters in the lens correction model, you might get better results with the full abcv set of parameters:

     tca_correct -o bv DSC_3194.ppm

This outputs some fulla parameters like so:

     -r 0.0000000:0.0001197:0.0000000:0.9997630 -b 0.0000000:-0.0001142:0.0000000:1.0001841

You can now use these with fulla when converting photos from this lens:

     fulla -r 0.0:0.0001197:0.0:0.9997630 -b 0.0:-0.0001142:0.0:1.0001841 -o corrected.tif DSC_3194.ppm

## Using with dcraw

dcraw[*] is a command-line RAW converter with the ability to apply scaling of red/blue channels at the Bayer interpolation stage. Simple scaling is not as sophisticated as the panotools polynomial used in fulla but is good enough for nearly all purposes. Start by extracting a test image from a RAW file:

     dcraw DSC_3194.NEF

Then run tca_correct on this PPM image, but tell it to only optimise v field of view[*] for the red and blue channels:

     tca_correct -o v DSC_3194.ppm

After a while some fulla correction parameters will be outputted:

     -r 0.0000000:0.0000000:0.0000000:1.0005943 -b 0.0000000:0.0000000:0.0000000:1.0008306

The two useful numbers (1.0005943 and 1.0008306) are the inverse of the numbers required by dcraw, so get a calculator and calculate the reciprocal of each:

     1 / 1.0005943 = 0.999406
     1 / 1.0008306 = 0.999170

Now when converting RAW files from this lens you can use the dcraw -C parameter to correct TCA[*]:

     dcraw -C 0.999406 0.999170 [OPTIONS...] DSC_3194.NEF

Retrieved from "http://wiki.panotools.org/index.php?title=Tca_correct&oldid=11191[*]"