White Balance Correction🔗

Summary🔗

Color balance can be adjusted using the set of tools demonstrated in this cookbook. Let us first take a look at a couple of examples. In the first example, the upper image has a brownish tone and in the second example it has a blueish tone in the background. After the white balance correction, the background is corrected as white.

  • Example 1. Correcting a brownish background.

Whitening a brownish background

Whitening a brownish background🔗

  • Example 2. Correcting a blueish background.

Whitening a blueish background

Whitening a blueish background🔗

Detailed description🔗

Let us walk through the schema below top-down.

Processing graph

Processing graph🔗

  • Te test image originates from the virtual camera configured in Image Source.

  • The pixel intensities are linearized in Gamma Correction which has been configured to Compress mode. In this example we assume that the original image has been corrected with a gamma value 2.2. However, if the image comes from a file, the most likely value is sRGB. It is a special preset value configured to Gamma Correction tool. sRGB is also the default value. Linearization step is necessary in order to apply linear color balancing below.

  • In this example, our mission is to correct the background color which is known to be white, but does not look white in the image due to differences in lighting. A reference area with the known color (in this case white) is sampled with a Color Sampling tool. The bigger the area, the better the result will be because more noise can be filtered out. The location of the area is selected by dragging the Frame input on the image display. In this case, the lower right corner of the image is selected for color sampling.

Color compression and sampling

Color compression and sampling🔗

  • The known reference color is set in Color Ratio tool. In this example, the reference value on each color channel is 240, so the reference color is nearly white. The color is given as a hexadecimal value in the order red, green, blue. So in this case, the hex value is f0f0f0 (f0 hex = 240 decimal). The tool outputs scaling factors for each color channel.

  • Color Balancing tool applies the correction to the input image. In this example, the tool balances the color channels so that the color measured from the reference area becomes white on average. The output is a corrected image with linear colors.

  • Gamma expansion is applied to the linearized image with the same gamma coefficient as was used above in the compression step. The gamma value 2.2 is the best for contemporary display devices. If you want to save the image to a file, the best option is to use the default value sRGB. The mode in Gamma Correction tool is set as Expand.

Color correction and expansion

Color correction and expansion🔗