コンテンツにスキップ

デモザイクモード#

Demosaicing Mode カメラ機能を使用すると、デモザイクに使用する方法を変更できます。

これは画質の最適化に役立ちます。

情報

This feature is available for Basler ace 2, boost R, and dart R cameras.

Basler ace U/L cameras also provide a DemosaicingMode parameter but this only serves to enable the PGI Feature Set.

機能を使用する#

Demosaicing Modeを使用する理由#

デモザイク(デベイヤリングとも呼ばれます)は、イメージセンサーのカラー出力から RGB 情報を生成するために実行されます。

Basler カラーカメラは、ピクセルフォーマットがベイヤーフォーマットに設定されている場合でも、常にデモザイクを実行します。これはカメラの内部画像処理によるものです。

カメラには、デモザイクのためのさまざまな方法が備えられています。デフォルトでは、設定されたピクセルフォーマットに基づいて方式が自動的に決定されます。

自動的に選択された方法によって生成された結果が用途を満たすものではない場合、デモザイクモードを手動で調整できます。

たとえば、カメラはベイヤーピクセルフォーマットに対しては Nearest Neighbor 方法を自動的に選択します。そのように選択されるのは、古いファームウェアバージョンとの互換性を確保するためです。ただし、多くの場合、Unilinear 方法の方がより良い結果が得られます。

デモザイク法#

次のデモザイク法を使用できます。

デモザイク法 説明 非ベイヤーピクセルフォーマットに適しています ベイヤーピクセルフォーマットに適しています
Average Green 最も近いピクセルの 1 つからの情報、または周囲の緑のピクセルの算術平均を使用します。Basler PGI が利用できない場合、これは、非ベイヤーピクセルフォーマットのデフォルトの方法です。
Basler PGI 利用可能な場合は、高度なデモザイクのための Basler PGI アルゴリズムを使用します。
Nearest Neighbor 最も近いピクセルの 1 つからの情報を使用します。これはベイヤーピクセルフォーマットのデフォルトの方法であり、以前のファームウェアバージョンとの最良の互換性を提供します。
Unilinear 最も近いピクセルの 1 つからの情報、または周囲のピクセルの算術平均を使用します。Nearest Neighbor デモザイクと比較して、エッジで発生する色のアーチファクトが少なくなります。

デモザイクモード#

次のデモザイクモードを使用できます。

  • Auto:デモザイク法は、設定されたピクセルフォーマットに基づいて自動的に決定されます。
  • Manual:デモザイク法を手動で設定できます。

デモザイクの設定#

デモザイクに使用する方法を変更するには、次のようにします。

  1. Set the BslDemosaicingMode parameter to Manual.
  2. Set the BslDemosaicingMethod parameter to the desired demosaicing method, e.g., Unilinear.

サンプルコード#

// Enable manual adjustment of the demosaicing method
camera.BslDemosaicingMode.SetValue(BslDemosaicingMode_Manual);
// Set the demosaicing method to Unilinear
camera.BslDemosaicingMethod.SetValue(BslDemosaicingMethod_Unilinear);
INodeMap& nodemap = camera.GetNodeMap();
// Enable manual adjustment of the demosaicing method
CEnumParameter(nodemap, "BslDemosaicingMode").SetValue("Manual");
// Set the demosaicing method to Unilinear
CEnumParameter(nodemap, "BslDemosaicingMethod").SetValue("Unilinear");
// Enable manual adjustment of the demosaicing method
camera.Parameters[PLCamera.BslDemosaicingMode].SetValue(PLCamera.BslDemosaicingMode.Manual);
// Set the demosaicing method to Unilinear
camera.Parameters[PLCamera.BslDemosaicingMethod].SetValue(PLCamera.BslDemosaicingMethod.Unilinear);
/* 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 manual adjustment of the demosaicing method */
errRes = PylonDeviceFeatureFromString(hdev, "BslDemosaicingMode", "Manual");
CHECK(errRes);
/* Set the demosaicing method to Unilinear */
errRes = PylonDeviceFeatureFromString(hdev, "BslDemosaicingMethod", "Unilinear");
CHECK(errRes);
# Enable manual adjustment of the demosaicing method
camera.BslDemosaicingMode.Value = "Manual"
# Set the demosaicing method to Unilinear
camera.BslDemosaicingMethod.Value = "Unilinear"

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