コンテンツにスキップ

Color Transformation#

Color Transformationカメラ機能を使用すると、センサーから送信されたカラー情報を修正できます。

カラー変換マトリックスを使用すると、画像取得時に使用された光源によるカラーシフトを補正したり、センサーのカラー生成プロセスでの不完全性を補正したりすることができます。

情報

この機能は、マトリックスカラー変換について十分に理解している場合のみ使用してください。試行錯誤により変換マトリックスに正しい値を入力することはほぼ不可能です。

機能を使用する#

Color Transformationの設定#

  1. ホワイトバランスが適切に設定されていることを確認します。
  2. Set the ProcessedRawEnable parameter to true (if available and if you're using a Bayer pixel format).
  3. Set the LightSourcePreset parameter to Custom (if available).
  4. Set the ColorTransformationValueSelector parameter to the desired position in the matrix, e.g., Gain00.
  5. Enter the desired value for the ColorTransformationValue parameter to adjust the value at the selected position. The parameter's value range is -8.0 to +7.96875.

情報

変換マトリックスには既にカラー変換値が設定されています。これらは、以前に選択した光源の初期値に関連付けられているか、単位ベクトルに対応しているか、または以前にカラー変換機能を使用した結果に対応しています。

ColorTransformationMatrixFactorパラメーター

このパラメーターは、GigEインターフェース付きのace Classic/U/Lカメラでのみ使用でき、カラーマトリックスがカラー値に与える影響の度合いを決定します。0に設定すると、マトリックスは実質的に無効になります。Baslerは、デフォルト設定(1)のままにしておくことをおすすめします。

仕組み#

カラー変換機能では、変換マトリックスを使用して、各画素の変更された赤、緑、および青の画素データを提供します。

変換は、R、G、およびBピクセル値を含む3 x 1マトリックスに、カラー変換値を含む3 x 3マトリックスを事前に乗算することによって実行されます。

Color Transformationマトリックス

必要に応じて、各マトリックス値(Gain00、Gain01など)を設定できます。

サンプルコード#

// Select position Gain00 in the matrix
camera.ColorTransformationValueSelector.SetValue(ColorTransformationValueSelector_Gain00);
// Enter a floating point value for the selected position
camera.ColorTransformationValue.SetValue(1.5625);
// Select position Gain01 in the matrix
camera.ColorTransformationValueSelector.SetValue(ColorTransformationValueSelector_Gain01);
// Enter a floating point value for the selected position
camera.ColorTransformationValue.SetValue(-0.4375);
INodeMap& nodemap = camera.GetNodeMap();
// Select position Gain00 in the matrix
CEnumParameter(nodemap, "ColorTransformationValueSelector").SetValue("Gain00");
// Enter a floating point value for the selected position
CFloatParameter(nodemap, "ColorTransformationValue").SetValue(1.5625);
// Select position Gain01 in the matrix
CEnumParameter(nodemap, "ColorTransformationValueSelector").SetValue("Gain01");
// Enter a floating point value for the selected position
CFloatParameter(nodemap, "ColorTransformationValue").SetValue(-0.4375);
// Select position Gain00 in the matrix
camera.Parameters[PLCamera.ColorTransformationValueSelector].SetValue(PLCamera.ColorTransformationValueSelector.Gain00);
// Enter a floating point value for the selected position
camera.Parameters[PLCamera.ColorTransformationValue].SetValue(1.5625);
// Select position Gain01 in the matrix
camera.Parameters[PLCamera.ColorTransformationValueSelector].SetValue(PLCamera.ColorTransformationValueSelector.Gain01);
// Enter a floating point value for the selected position
camera.Parameters[PLCamera.ColorTransformationValue].SetValue(-0.4375);
/* 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 position Gain00 in the matrix */
errRes = PylonDeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain00");
CHECK(errRes);
/* Enter a floating point value for the selected position */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorTransformationValue", 1.5625);
CHECK(errRes);
/* Select position Gain01 in the matrix */
errRes = PylonDeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain01");
CHECK(errRes);
/* Enter a floating point value for the selected position */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorTransformationValue", -0.4375);
CHECK(errRes);
# Select position Gain00 in the matrix
camera.ColorTransformationValueSelector.Value = "Gain00"
# Enter a floating point value for the selected position
camera.ColorTransformationValue.Value = 1.5625
# Select position Gain01 in the matrix
camera.ColorTransformationValueSelector.Value = "Gain01"
# Enter a floating point value for the selected position
camera.ColorTransformationValue.Value = -0.4375

pylon Viewerを使用して、パラメーターを簡単に設定することもできます。