Balance White Auto#
オートファンクションの画素データは、1つ以上のオートファンクションROIから取得できます。
カラーシフトを手動で修正するには、Balance White機能を使用します。
機能を使用する#
Balance White Autoの有効化/無効化#
Balance White Autoオートファンクションを有効または無効にするには、次の手順に従います。
- Balance White Autoオートファンクションに少なくとも1つのオートファンクションROIを割り当てます。
オートファンクションROIが画像ROIと部分的または完全にオーバーラップするようにしてください。 - パラメーターを
BalanceWhiteAutoパラメーターを次のいずれかの動作モードに設定します。Once: The camera adjusts the white balance until the average gray values for red, green, and blue are identical. When this has been achieved, or after several calculation cycles, the camera sets the auto function toOffand applies the balance ratios resulting from the last calculation to all following images.Continuous: The camera adjusts the white balance continuously while images are being acquired. The adjustment process continues until the operating mode is set toOnceまたはOff.Off: Disables the Balance White Auto auto function. TheBalanceRatioparameters remain at the values resulting from the last automatic or manual adjustment.
情報
On the following camera models, the Continuous operating mode is not available: acA1920-25gc, acA2500-14gc, racer 2 S color cameras
仕組み#
Automatic white balancing is a two-step process.
Depending on the camera model, the BalanceRatio parameter is set in the following way:
ace Classic#
For Basler ace Classic camera models, automatic white balancing works as follows:
- イメージ
BalanceRatioAbsparameter values for red, green, and blue are each set to 1.5. - Assuming a "gray world" model, the
BalanceRatioAbsparameter values are automatically adjusted so that the average red and blue pixel values match the average green pixel value.
ace U/L, MED ace, boost V, dart Classic, pulse#
For Basler ace U, ace L, MED ace, boost V, dart Classic, and pulse camera models, automatic white balancing works as follows:
- The camera compares the average gray values of the red, green, and blue pixels. It determines the color with the highest average gray value (i.e., the brightest color) and sets the
BalanceRatioparameter value for this color to 1. -
The camera automatically adjusts the
BalanceRatioparameter values of the other two colors until the average gray values for red, green, and blue are identical.As a result, the
BalanceRatioparameter is set to 1 for one color and to a value between 1 and ≈15.98 for the other two colors.例: Assume the green pixels in your image have the highest average gray value. If you enable the Balance White Auto auto function, the camera sets the
BalanceRatioparameter value for green to 1. Then, the camera automatically adjusts theBalanceRatioparameter values for red and blue until the average gray values for red, green, and blue are identical. The new balance ratios could be, e.g., green = 1, red = 1.08789, and blue = 2.19678.
ace 2, boost R, dart R, dart M, racer 2 S/L#
For Basler ace 2, boost R, dart R, dart M, and racer 2 L/S camera models, automatic white balancing works as follows:
- The camera compares the average gray values of the red, green, and blue pixels. It determines the color with the median average gray value and sets the
BalanceRatioparameter value for this color to 1. -
The camera automatically adjusts the
BalanceRatioparameter values of the other two colors until the average gray values for red, green, and blue are identical.As a result, the BalanceRatio parameter is set to 1 for the color with the median gray value. For the color with a higher gray value compared to the median value, the BalanceRatio parameter is set to a value between 0 and 1, and for the color with a lower gray value compared to the median gray value the parameter is set between 1 and ≈15.98.
例: Assume the green pixels in your image have the median gray value, the red pixels have a higher gray value, and the blue pixels have a lower gray value than the green pixels.
If you enable the Balance White Auto auto function, the camera sets theBalanceRatioparameter value for green to 1, for red to a value between 0 and 1, and the value for blue to a value between 1 and ≈15.98. The new balance ratios could be, e.g., green = 1, red = 0.568, and blue = 3.1986.
情報
- To view the
BalanceRatioparameter values for red, green, or blue, switch to the respective color channel using theBalanceRatioSelector. - カメラが画像を連続的にキャプチャしている場合、オートファンクションは短い遅延を伴って有効になります。最初の何枚かの画像は、オートファンクションの影響を受けない場合があります。
- On boost V color cameras, the auto function ROIs which are assigned to the Balance White Auto auto function, must not contain any color pixels with 100 % saturation. Otherwise, undesirable false-color effects will occur.
サンプルコード#
ace Classic/U/L GigEカメラ#
// Select auto function ROI 2
camera.AutoFunctionAOISelector.SetValue(AutoFunctionAOISelector_AOI2);
// Enable the Balance White Auto auto function
// for the auto function ROI selected
camera.AutoFunctionAOIUsageWhiteBalance.SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.SetValue(BalanceWhiteAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Select auto function ROI 2
CEnumParameter(nodemap, "AutoFunctionAOISelector").SetValue("AOI2");
// Enable the Balance White Auto auto function
// for the auto function ROI selected
CBooleanParameter(nodemap, "AutoFunctionAOIUsageWhiteBalance").SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "BalanceWhiteAuto").SetValue("Continuous");
// Select auto function ROI 2
camera.Parameters[PLCamera.AutoFunctionAOISelector].SetValue(PLCamera.AutoFunctionAOISelector.AOI2);
// Enable the Balance White Auto auto function
// for the auto function ROI selected
camera.Parameters[PLCamera.AutoFunctionAOIUsageWhiteBalance].SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.BalanceWhiteAuto].SetValue(PLCamera.BalanceWhiteAuto.Continuous);
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
/* Select auto function ROI 2 */
errRes = PylonDeviceFeatureFromString(hdev, "AutoFunctionAOISelector", "AOI2");
CHECK(errRes);
/* Enable the Balance White Auto auto function */
/* for the auto function ROI selected */
errRes = PylonDeviceSetBooleanFeature(hdev, "AutoFunctionAOIUsageWhiteBalance", 1);
CHECK(errRes);
/* Enable Balance White Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "BalanceWhiteAuto", "Continuous");
CHECK(errRes);
# Select auto function ROI 2
camera.AutoFunctionAOISelector.Value = "AOI2"
# Enable the Balance White Auto auto function
# for the auto function ROI selected
camera.AutoFunctionAOIUsageWhiteBalance.Value = True
# Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.Value = "Continuous"
その他のカメラ#
// Select auto function ROI 2
camera.AutoFunctionROISelector.SetValue(AutoFunctionROISelector_ROI2);
// Enable the Balance White Auto auto function
// for the auto function ROI selected
camera.AutoFunctionROIUseWhiteBalance.SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.SetValue(BalanceWhiteAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Select auto function ROI 2
CEnumParameter(nodemap, "AutoFunctionROISelector").SetValue("ROI2");
// Enable the Balance White Auto auto function
// for the auto function ROI selected
CBooleanParameter(nodemap, "AutoFunctionROIUseWhiteBalance").SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "BalanceWhiteAuto").SetValue("Continuous");
// Select auto function ROI 2
camera.Parameters[PLCamera.AutoFunctionROISelector].SetValue(PLCamera.AutoFunctionROISelector.ROI2);
// Enable the Balance White Auto auto function
// for the auto function ROI selected
camera.Parameters[PLCamera.AutoFunctionROIUseWhiteBalance].SetValue(true);
// Enable Balance White Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.BalanceWhiteAuto].SetValue(PLCamera.BalanceWhiteAuto.Continuous);
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
/* Select auto function ROI 2 */
errRes = PylonDeviceFeatureFromString(hdev, "AutoFunctionROISelector", "ROI2");
CHECK(errRes);
/* Enable the Balance White Auto auto function */
/* for the auto function ROI selected */
errRes = PylonDeviceSetBooleanFeature(hdev, "AutoFunctionROIUseWhiteBalance", 1);
CHECK(errRes);
/* Enable Balance White Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "BalanceWhiteAuto", "Continuous");
CHECK(errRes);
# Select auto function ROI 2
camera.AutoFunctionROISelector.Value = "ROI2"
# Enable the Balance White Auto auto function
# for the auto function ROI selected
camera.AutoFunctionROIUseWhiteBalance.Value = True
# Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.Value = "Continuous"
pylon Viewerを使用して、パラメーターを簡単に設定することもできます。