c++colorscameraidsueye

How to manualy set white balance of a uEye camera?


How can I programmatically set the white balance of an uEye USB camera (from the IDS manufacturer) to work with no automatic white balance and pre-defined multipliers when is_SetWhiteBalanceMultipliers() function is obsolete?

Some background: I work with a uEye USB2 camera (from IDS) connected to Linux machine. I need to get an RGB image with pre-defined colors (of cause on a pre-defined scene) from the camera. For example, I want to configure the WB to red 1.25 multiplier, green 1.0, and blue 2.0 multiplier. For this task, I am using the uEye SDK on Linux (header file ueye.h). The manual (A: Camera basics > Camera parameters) states that the is_SetWhiteBalanceMultipliers() function is obsolete and suggests to use is_SetAutoParameter() function instead. It was easy to disable the auto-white balance (is_SetAutoParameter( hCam, IS_SET_ENABLE_AUTO_WHITEBALANCE, 0, 0), but I struggle to find a way to configure the red/green/blue multipliers. The parameter IS_SET_AUTO_WB_OFFSET and IS_SET_AUTO_WB_GAIN_RANGE work only when the automatic white balance engaged and do nothing when it is disabled.
I will be grateful for any suggestions!


Solution

  • I had the same issue. I think you can achieve the old result using the function "is_SetHardwareGain" on which you directly pass the main, red, green and blue gains. In my case I disabled the white balance before doing it just to make sure it works. In this example, I wanted to set the values to RGB gains = [8%, 0%, 32%] and the master gain to 0% (to not confuse with gain factors 0% normally corresponds to 1x gain factor):

    double param1, param2; param1=0;
    is_SetColorCorrection (hCam, IS_CCOR_DISABLE, &param1); //Disables the color fitler correction matrix
    flagIDS = is_SetAutoParameter (hCam, IS_SET_ENABLE_AUTO_WHITEBALANCE, &param1, &param2);
    param1=WB_MODE_DISABLE;
    flagIDS = is_SetAutoParameter (hCam, IS_SET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &param1, &param2);
    flagIDS = is_SetHardwareGain (hCam, 0, 8, 0, 32);