-
Notifications
You must be signed in to change notification settings - Fork 0
Rendering Algorithms: Linearization
This step involves processing the input file to produce a linear image. In a linear image, the RGB or grayscale values are directly (mathematically) related to the light intensity. This correspondence ensures that scan values accurately reflect the densities of the original, allowing us to simulate the effect of light passing through an emulsion and viewing filter. Ideally, the input images should already be linear. Linear data are typically stored in RAW files, and some programs allow exporting this data to a 16-bit TIFF file, which is best suited for further processing.
The following parameters controls the linearization process and they are applied in the order as described here:
-
gamma
: gamma correction applied to the input data. Gamma 1 represents linear imput images. AdobeRGB uses gamma of 2.2, ProPhotoRGB gamma of 1.8 and sRGB has special gamma function similar but not quite same as gamma 2.2. This can be specified by magic value -1.Meaningful values are greater than 0 or equal to -1. Common image profiles has gamma between 1 and 2.4.
-
backlight_correction
andbacklight_correction_black
: when originals are captured with a backlight that is not perfectly even or when the lens has a vignetation, it is recommended to also capture a backlight itself just before digitizing the originals. This needs to be done with exactly the same settings (except possibly for exposure time) as is used for actual digitization and then usecolorscreen analyze-backlight
command to produce backlight correction data. These basically apply additive and multiplicative corrections (filed leveling) to different areas of the scan.backlight_correction
can be either set toyes
orno
. If it is setyes
the output ofanalyze-backlight
needs to follows and specifybacklight_correction_dimensions
,backlight_correction_channels
andbacklight_correction_lums
.When backlight correction is enabled
backlight_correction_black
can be used to fine-adjust black point in case it drifts between the captures. This is value added prior backlight correction and subtracted later.Meaningful values are in range of -1 and 1 (usually very close to 0). For stitched scans it is possible to adjust this value for each tile individually using
tile_adjustments
-
dark_point
: in the linearized data it is important for value 0 to represent actual black. In some scans black is shifted. To compensate for this dark_point is subtracted from the input data after gamma correction.Meaningful values are in range of 0 and 1 (usually very close to 0). For stitched scans it is possible to adjust this value for each tile individually using
tile_adjustments
-
scan_exposure
: input data are multiplied by this value afterdark_point
is subtracted. This has de-facto same effect asbrightness
parameter described later, but it is applied early and is useful primarily to compensate different exposures in stitched panoramas.Meaninful values are greater than 0. For stitched scans it is possible to adjust this value for each tile individually using
tile_adjustments
Overall formula is:
linear = apply_backlight_correction ((apply_gamma (input, gamma
) - dark_point
) scan_exposure
)
Where:
- apply_gamma (input,
gamma
) = pow (input,gamma
) ifgamma
>0 or it computes sRGB gamma function as specified in sRGB colorspace. - apply_backlight_correction (intput) = (input -
backlight_correction_black
- black_correction) * exposure_correction +backlight_correction_black
. Here black_correction and exposure_correction are taken from the precomputed backlight correction table and depends on the position of the pixel processed.
The fact that most museums does not preserve raw data and master tiff files has been already digitally altered (converted to sRGB or sGray color space, sharpened and level adjusted) presents important problem. We may add more controls making linearization more precise, but once such transformations has been done reverting them includes a lot of guesswork.
Even common raw data are not perfectly linear, since CMOS and CCD sensors have response curve that is linear only in certain area. Some raw processing software offers more precise linearization that takes in to account the fact that response is non-linear in the saturation area. Since additive color processes can get contrasty, we should implement this logic, too. Further research is necessary and this will likely lead to a need to calibrate common sensors used in scanners and cameras.