Controlling the white balance of your camera

This article describes how to manipulate the white balance of a color camera's Bayer tile pattern (R, G1, G2, B). The process does not apply to Blackfly S, Oryx, Firefly S/DL, Forge, or Dragonfly.

White balance is a name given to a system of color correction to deal with differing lighting conditions. Adjusting the white balance by modifying the relative gain of R, G and B in an image enables white areas to look "whiter". Taking some subset of the target image and looking at the relative red to green and blue to green response, the general idea is to scale the red and blue channels so that the response is 1:1:1.

For example, if the average pixel on the target was 222 (R), 232 (G), 236 (B) then all the reds should be scaled up by 232/222 and the blues down by 232/236. The mechanism for controlling white balance is provided by the WHITE_BALANCE register.


USING WHITE_BALANCE REGISTER 80Ch

This register controls the relative gain of pixels in the Bayer tiling used in the CCD of a color camera. For more information on this register, refer to your camera's Technical Reference manual or the Digital Camera Register Reference.

You can manipulate the contents of this register in three ways: using the FlyCapture software to directly modify the register’s values; using the software’s GUI interface to adjust the Blue and Red balances; or making a specific API function call.

    1. To modify the register’s values using Flycap.exe or FlyCap2.exe (FlyCapture2 SDK):
      • After you've selected the camera you want and started grabbing images, open the Camera Control dialog box.
      • Select the Camera Registers tab and enter 80C in the register text box.
      • If you click Get/Read Register, bits 8-19 represent the Blue value, and 20-31 the Red.
    1. To modify the white balance using a GUI interface, select the White Balance tab in the Camera Control dialog box.
    2. To modify the white balance register using an API function call (in your custom application), make a call to flycaptureSetCameraProperty(), or SetProperty() in FlyCapture2. See the API Documentation for further information.