コンテンツにスキップ

Balance White Auto (dart E)#

Balance White Autoカメラ機能は、取得した画像のカラーシフトを自動的に補正します。

カラーシフトを手動で修正するには、Balance White機能を使用します。

機能を使用する#

Balance White Autoの有効化/無効化#

To enable or disable the Balance White Auto auto function, set the BalanceWhiteAuto パラメーターを次のいずれかの動作モードに設定します。

  • Continuous: The camera adjusts the white balance continuously while images are being acquired.
  • Off: Disables the Balance White Auto auto function. The BalanceRatio parameters remain at the values resulting from the last automatic or manual adjustment.

仕組み#

自動ホワイトバランス調整は、2段階のプロセスで構成されます。

  1. 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 BalanceRatio parameter value for this color to 1.
  2. The camera automatically adjusts the BalanceRatio parameter 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 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 BalanceRatio parameter value for green to 1. Then, the camera automatically adjusts the BalanceRatio parameter 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.

情報

  • To view the BalanceRatio parameter values for red, green, or blue, switch to the respective color channel using the BalanceRatioSelector.
  • カメラが画像を連続的にキャプチャしている場合、オートファンクションは短い遅延を伴って有効になります。最初の何枚かの画像は、オートファンクションの影響を受けない場合があります。

サンプルコード#

// Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.SetValue(BalanceWhiteAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Enable Balance White Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "BalanceWhiteAuto").SetValue("Continuous");
// 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 */
/* Enable Balance White Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "BalanceWhiteAuto", "Continuous");
CHECK(errRes);
# Enable Balance White Auto by setting the operating mode to Continuous
camera.BalanceWhiteAuto.Value = "Continuous"

You can also use the pylon Viewer to easily set the parameters.