Saturday 12 March 2011

Extracting RGB values from tiff file with Argyll

[Link to scanin]

.val file
8-bit RGB patch values can be extracted from tiff file using the function scanin with option -o.  The extracted RGB data in .val file is of the standard 8-bit RGB representation.

The typical command line to carry out such function and partial listing of the .val file are as follows.

    scanin  -o  input.tif  it8.cht 
...
A01 42.818 29.194 32.925
A02 50.670 25.994 30.010
A03 58.323 23.304 28.780
...

.ct3 file
In .ct3, the 8-bit RGB values have been normalized with a factor of  (100/255)

SAMPLE_ID XYZ_X XYZ_Y XYZ_Z RGB_R RGB_G RGB_B STDEV_R STDEV_G STDEV_B
A01 3.7800 3.0600 2.6900 16.791 11.449 12.912 0.41150 0.40085 0.43268
A02 4.5900 3.0500 2.2900 19.871 10.194 11.768 0.39215 0.38156 0.41973
A03 5.5000 3.1500 2.0500 22.872 9.1387 11.286 0.37277 0.36667 0.40311
...

Hence, to revert back to standard  8-bit rgb values is by multiplying a factor of (255/100).
For instance, for patch A01,
       R = 16.791 x (255/100) = 42.817
       G = 11.449 x (255/100) = 29.194
       B = 12.912 x (255/100) = 32.925


Averaging of Pixel values
RGB values are computed with scanin by averaging of the pixel values within a sample square, using a "robust" mean in that pixel values that are too far from the average ("outlier" pixel values) are discarded. This is done in an attempt to filter off values that are due to scanning artifacts such as dust, scratches etc. Option -m flag forces scanin to return the true mean values for the sample squares that includes all the pixel values.

No comments:

Post a Comment