コンテンツにスキップ
ステージングサーバー
開発サーバー

Shading Correction#

Shading Correction カメラ機能を使用すると、センサーピクセルの光感度の違いによって生じる画像の不均一性を軽減できます。また、照明や照明用光学系に起因するアーティファクトを最小限に抑えることもできます。

Shading correctionは、カメラに保存されている、適切な補正データを含むファイルをベースにしています。画像取得時にこれらが元のピクセル値に適用されるため、画像が改善されます。

Shading Correction機能は、racer 2カメラでのみ使用できます。

機能を使用する#

仕組み#

DSNUおよびPRNU補正#

Shading correctionにより、暗電流不均一性(DSNU)および光応答不均一性(PRNU)に起因する画像アーティファクトを最小限に抑えます。カメラでは、次の2種類のshading correctionを使用できます。

  • DSNU correction: カメラが完全に暗い状態でラインを撮影する場合、ライン内のすべてのピクセル値はほぼゼロであり、かつ等しい必要があります。実際には、センサー内のピクセルの性能にわずかな違いがあるため、カメラが暗い状態でラインを撮影する際に出力されるピクセル値に多少の変動が生じます。DSNU correctionはこの種の変動を補正します。取得されたライン内の各ピクセル値に個別の階調値(オフセット)を加算することで機能します。

  • PRNU correction: 明るく均一に照明された表面を向いた状態でカメラがラインを撮影する場合、ライン内のすべてのピクセル値は最大階調値に近く、かつ等しい必要があります。実際には、センサー内のピクセルの性能のわずかな違いや、光学系や照明の変動により、カメラから出力されるピクセル値に変動が生じます。PRNU correctionはこの種の変動を補正します。取得されたライン内の各ピクセル値に個別の乗数(ゲイン)を適用することで機能します。

Shading correctionはピクセル単位のキャリブレーション方法であり、つまり各ピクセルに対して補正値が計算されます。

情報

DSNU correctionのみ、PRNU correctionのみ、または両方のタイプのshading correctionを実行するようにカメラを設定できます。両方のタイプのshading correctionを実行する場合、カメラは最初にDSNU correctionを実行し、次にPRNU correctionを実行します。

Shading Correctionセット#

DSNUおよびPRNU correctionに使用される補正値は、shading correction setと呼ばれるファイルに保存されます。次の2種類があります。

Shading Correctionファイルのダウンロード#

情報

  • Shading correctionファイルをダウンロードすることは、補正データのバックアップに役立ちます。
  • Baslerでは、ファームウェアアップデートを実行する前に補正ファイルをバックアップすることを強くお勧めします。
  • ダウンロードしたshading correctionファイルを編集しないでください。

pylon Viewerを使用してshading correctionファイルをダウンロードするには:

  1. pylon Viewerで、shading correctionデータファイルをダウンロードするカメラを開きます。
  2. pylon Viewerの[カメラ]メニューで、[ファイルアクセス]をクリックします。
  3. Camera Fileドロップダウンボックスで、ダウンロードするファイルに応じてPRNU CorrectionまたはDSNU Correctionを選択します。
    適切なエントリがない場合、shading correctionファイルのダウンロードはお使いのカメラではサポートされていません。
  4. [ダウンロード]をクリックし、ファイルを保存するディレクトリーに移動して、任意のファイル名を入力します。
  5. Saveをクリックします。
  6. Camera File Accessダイアログを閉じます。

Shading Correctionファイルのアップロード#

情報

  • User shading correctionファイルをカメラにアップロードする場合は、選択したcorrection setが、補正データをロードするカメラ上で作成されたものであることを確認してください。
  • Baslerでは、編集されたUser shading correctionファイルをアップロードしないことを強くお勧めします。

pylon Viewerを使用してUser shading correctionファイルをアップロードするには:

  1. pylon Viewerで、shading correctionデータファイルをアップロードするカメラを開きます。
  2. pylon Viewerの[カメラ]メニューで、[ファイルアクセス]をクリックします。
  3. Camera Fileドロップダウンボックスで、PRNU CorrectionまたはDSNU Correctionを選択します。
    PRNU CorrectionまたはDSNU Correctionのエントリがない場合、correctionファイルのアップロードはお使いのカメラではサポートされていません。
  4. [Upload]をクリックして、アップロードするファイルに移動します。
  5. [開く]をクリックします。
  6. Camera File Accessダイアログを閉じます。

アップロード後に Shading Correction ファイルを適用するには、次のパラメータが対応するインデックス番号に設定されていることを確認してください。 BslShadingCorrectionMode パラメータが次のように設定されている場合、 User そして BslShadingCorrectionSetIndex パラメータが対応するインデックス番号に設定されていることを確認してください。

Shading Correctionモード#

Shading Correction モードでは、Shading Correction を工場出荷時またはユーザー補正セットに保存された値のどちらに基づくかを決定します。

Shading Correction モードを設定するには、次のパラメータを設定します。 BslShadingCorrectionMode パラメーターを次のいずれかの値に設定します。

  • Factory (デフォルト): Shading Correction は、次のデータに基づきます。 工場出荷時 の補正セット。
  • User: Shading Correction は、次の場所に保存されている値に基づきます。 ユーザー の補正セット。
  • Off: カメラは 厳密な Shading Correction を実行しません。

Shading Correctionセットの作成#

ユーザー定義の Shading Correction セットの作成を開始する前に、以下の項目が必要です。

  • レンズを完全に覆うための適切なオブジェクト(レンズキャップなど)
  • 白い紙など、均一な背景を持つターゲット

情報

  • 最良の結果を得るには、通常運用時と同様に、光学系、ラインレート、Exposure Time、ゲイン、カメラ温度を調整してください。Basler では、実際のアプリケーション環境で暗電流画像および明視野画像を取得することを推奨しています。
  • racer 2 L カメラ: デュアル (またはクアッド) ライン センサー取得モードでは、シングル (またはデュアル) ラインモードで作成された Shading Correction セットのステータスは空として表示されます (BslShadingCorrectionSetStatus = Empty)、このセットにはすでに補正データが存在しますが。
    デュアルまたはクアッドラインモードで新しい Shading Correction セットを作成する場合は、ライン数が少ないモードで作成された補正セットのインデックス番号を確認してください。インデックス番号がすでに使用されている場合は、新しいセット用に別の番号を選択してください。そうしないと、補正データが上書きされ、新しい補正値に置き換えられます。

DSNU補正セット#

DSNU correction 用の Shading Correction セットを作成するには:

  1. レンズにプラスチックキャップを装着するなどして、カメラのセンサーに光が当たらないようにします。
  2. パラメーターを BslShadingCorrectionSelector パラメータを次のように設定: DSNU.
  3. パラメーターを BslShadingCorrectionMode パラメータを次のように設定: User.
  4. パラメーターを BslShadingCorrectionSetIndex パラメータを作成するセットの希望するインデックス番号 (例: 1) に設定します。
  5. パラメーターを BslShadingCorrectionROISelector パラメータを希望する Shading Correction ROI (例: ROI 1) に設定します。
  6. 必要に応じて、次のパラメータを使用して Shading Correction ROI の位置とサイズを設定します。
    • BslShadingCorrectionROIOffsetX: センサーの左側からの Shading Correction ROI の水平オフセット (ピクセル単位)。
    • BslShadingCorrectionROIWidth: Shading Correction ROI の幅 (ピクセル単位)。
  7. 画像acquisitionを開始するには、pylon Viewer のツールバーにある Continuous Shot ボタンをクリックします。
  8. 実行する BslShadingCorrectionSetCreate 新しい Shading Correction セットを作成するためのコマンドです。
    合計256枚のダーク画像が取得され、評価されます。結果として得られた DSNU 補正データが生成され、指定された Shading Correction セットに収集されて、カメラのフラッシュメモリに保存されます。たとえばインデックス番号1の Shading Correction セットにすでに補正データが含まれている場合、これらは上書きされ、新しい補正値に置き換えられます。

    情報

    DSNU 補正データの作成中に PRNU 補正セットが有効になっている場合、PRNU 補正値は計算から除外されます。

    作成された Shading Correction セットは自動的に有効になります。

  9. Shading Correction セットの作成結果を確認するには、以下の値を取得します BslShadingCorrectionSetCreateResult パラメータ。

PRNU補正セット#

PRNU 補正用の Shading Correction セットを作成するには:

  1. カメラの視野全体に白い紙を置くなどして、センサーを 70 % の飽和度まで均一に照明します。
  2. パラメーターを BslShadingCorrectionSelector パラメータを次のように設定: PRNU.
  3. パラメーターを BslShadingCorrectionMode パラメータを次のように設定: User.
  4. パラメーターを BslShadingCorrectionSetIndex パラメータを、作成するセットの希望するインデックス番号(例:2)に設定します。
  5. パラメーターを BslShadingCorrectionROISelector パラメータを希望する Shading Correction ROI (例: ROI 1) に設定します。
  6. 必要に応じて、次のパラメータを使用して Shading Correction ROI の位置とサイズを設定します。
    • BslShadingCorrectionROIOffsetX: センサーの左側からの Shading Correction ROI の水平オフセット (ピクセル単位)。
    • BslShadingCorrectionROIWidth: Shading Correction ROI の幅 (ピクセル単位)。
  7. pylon Viewer のツールバーにある Continuous Shot ボタンをクリックして、画像取得を開始します。
  8. 実行する BslShadingCorrectionSetCreate 新しい Shading Correction セットを作成するためのコマンドです。
    合計256枚の明画像が取得され、評価されます。結果として得られた PRNU 補正データが生成され、選択された Shading Correction セットに収集されて、カメラのフラッシュメモリに保存されます。たとえばインデックス番号2の Shading Correction セットにすでに補正データが含まれている場合、これらは上書きされ、新しい補正値に置き換えられます。

    情報

    PRNU 補正データの作成中に DSNU 補正セットが有効になっている場合、DSNU 補正値が計算に考慮されます。

    作成された Shading Correction セットは自動的に有効になります。

  9. Shading Correction セットの作成結果を確認するには、以下の値を取得します BslShadingCorrectionSetCreateResult パラメータ。

  10. 必要に応じて、PRNU 補正のターゲットグレー値を調整し、ステップ7を繰り返します。カラーカメラを使用している場合は、カラーチャンネルごとに PRNU 補正のターゲットグレー値を個別に調整し、ステップ7を繰り返します。

PRNU補正のターゲットグレー値の調整#

PRNU 補正セットの作成中、カメラは明視野画像内の最大輝度値を検出します。ただし、達成したいセンサー輝度の相対的なターゲットグレー値を調整したい場合もあります。これには、たとえば次のような理由があります:

  • 補正値が許容範囲外であるため、Shading Correction セットを作成できません。
  • 画像上の明るいスポット(光の反射などによるもの)により、補正セットの作成中にカメラによって検出される最大輝度値が高くなります。補正データを改善するために、補正データの計算に関連するこの値を減らすことができます。

PRNU 補正のターゲットグレー値を調整するには:

  1. パラメーターを BslShadingCorrectionTargetSelector パラメーターを次のいずれかの値に設定します。
    • All (モノクロカメラのみ):ターゲットグレー値はすべてのセンサーラインに適用されます。
    • Red, Green, Blue (カラーカメラのみ):ターゲットグレー値はそれぞれのカラーチャンネルに適用されます。
  2. パラメーターを BslShadingCorrectionTargetValue パラメータを希望の相対ターゲットグレー値に設定します。
  3. カラーカメラを使用している場合は、ステップ1と2を繰り返して、希望するターゲットグレー値を他のカラーチャンネルに適用します。

情報

  • イメージ BslShadingCorrectionTargetValue パラメータは、次の場合にのみ使用できます PRNU 補正セットの作成.
  • 絶対ターゲットグレー値が最大測定値よりも低いピクセルのみが補正されます。
  • Dual または Quad Line Sensor Acquisition Mode で動作する racer 2 L カメラの場合、ターゲットグレー値を調整すると予測不可能な結果が生じる可能性があります。代わりに Single Line モードとモノクロの Pixel Format を使用してください。

その他のパラメータ:

  • BslShadingCorrectionAbsoluteTargetValue:センサー輝度の絶対ターゲット値。これは、カメラの Sensor Bit Depth に基づいて計算された実際の輝度値です。
  • BslShadingCorrectionMaximumMeasuredValue:次のプロセスの実行中にカメラによって検出された最大輝度値 PRNU 補正セットの作成.

Shading Correctionセットの有効化#

Shading Correction セットを有効にするには、以下のように設定します。

  1. パラメーターを BslShadingCorrectionMode パラメータを次のように設定: User(ユーザー定義の correction set を有効にする場合)、または Factory(ファクトリー correction set を有効にする場合)。
  2. パラメーターを BslShadingCorrectionSetIndex パラメータを使用するセットのインデックス番号(例:インデックス番号2)に設定します。

    Shading Correction セットが自動的に有効になります。

  3. このプロセスが成功したかどうかを確認するには、次の値を取得します: BslShadingCorrectionSetStatus パラメータ。値が Okの場合、シェーディングセットは正常に有効化されています。これで、カメラは選択された Shading Correction セット内の補正値に基づいて Shading Correction を実行します。

情報

Shading Correction セットの変更は、画像集録中に行うこともできます。ただし、そのプロセス中にわずかな画像アーティファクトが発生する場合があります。

Shading Correctionの無効化#

Shading Correction を無効にするには、次のように設定します: BslShadingCorrectionMode パラメータを次のように設定: Off.

特性#

次の表は、racer 2 カメラで使用可能なシェーディングセットの数を示しています。

カメラモデル Max. Number of Lines Exposed per Acquisition Available Number of Shading Corrections Sets
r2L2048-29gc 3 10
r2L2048-58gm 1 32
r2L2048-62g5c 3 10
r2L2048-62cc 3 10
r2L2048-172cm 1 32
r2L2048-172g5m 1 32
r2L4096-14gc 2 16
r2L4096-29gm 1 32
r2L4096-42cc 2 16
r2L4096-42g5c 2 16
r2L4096-84cm 1 32
r2L4096-84g5m 1 16
r2L8192-80cc 3 10
r2L8192-240cm 4 8
r2L16384-60cc 2 16
r2L16384-120cm 2 16
r2T16416-500cm 1 32

サンプルコード#

// Set the type of shading correction to DSNU
camera.BslShadingCorrectionSelector.SetValue(BslShadingCorrectionSelector_DSNU);
// Or for PRNU: Set the type of shading correction to PRNU
camera.BslShadingCorrectionSelector.SetValue(BslShadingCorrectionSelector_PRNU);

// Note: Valid for DSNU and PRNU:
// Set the shading correction mode to User
camera.BslShadingCorrectionMode.SetValue(BslShadingCorrectionMode_User);
// Set the desired index number of the set to be created
camera.BslShadingCorrectionSetIndex.SetValue(1);
// Set the shading correction ROI selector to ROI 1
camera.BslShadingCorrectionROISelector.SetValue(BslShadingCorrectionROISelector_ROI1);
// Set the offset X of the ROI to 0
camera.BslShadingCorrectionROIOffsetX.SetValue(0);
// Set the ROI width to 2048
camera.BslShadingCorrectionROIWidth.SetValue(2048);

// Note: Valid for PRNU only:
// Set the shading correction target selector to red
camera.BslShadingCorrectionTargetSelector.SetValue(BslShadingCorrectionTargetSelector_Red);
// Set the shading correction target value for red to 1000
camera.BslShadingCorrectionTargetValue.SetValue(1.0000);
// Set the shading correction target selector to green
camera.BslShadingCorrectionTargetSelector.SetValue(BslShadingCorrectionTargetSelector_Green);
// Set the shading correction target value for green to 1000
camera.BslShadingCorrectionTargetValue.SetValue(1.0000);
// Set the shading correction target selector to blue
camera.BslShadingCorrectionTargetSelector.SetValue(BslShadingCorrectionTargetSelector_Blue);
// Set the shading correction target value for blue to 1000
camera.BslShadingCorrectionTargetValue.SetValue(1.0000);

// Note: Valid for DSNU and PRNU:
// Create new shading correction data for the shading correction set selected
camera.BslShadingCorrectionSetCreate.Execute();
// Get the status of the shading correction set selected
BslShadingCorrectionSetStatus setStatus = camera.BslShadingCorrectionSetStatus.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Set the type of shading correction to DSNU
CEnumParameter(nodemap, "BslShadingCorrectionSelector").SetValue("DSNU");
// Or for PRNU: Set the type of shading correction to PRNU
CEnumParameter(nodemap, "BslShadingCorrectionSelector").SetValue("PRNU");

// Note: Valid for DSNU and PRNU:
// Set the shading correction mode to User
CEnumParameter(nodemap, "BslShadingCorrectionMode").SetValue("User");
// Set the desired index number of the set to be created
CIntegerParameter(nodemap, "BslShadingCorrectionSetIndex").SetValue(1);
// Set the shading correction ROI selector to ROI 1
CEnumParameter(nodemap, "BslShadingCorrectionROISelector").SetValue("ROI1");
// Set the offset X of the ROI to 0
CIntegerParameter(nodemap, "BslShadingCorrectionROIOffsetX").SetValue(0);
// Set the ROI width to 2048
CIntegerParameter(nodemap, "BslShadingCorrectionROIWidth").SetValue(2048);

// Note: Valid for PRNU only:
// Set the shading correction target selector to red
CEnumParameter(nodemap, "BslShadingCorrectionTargetSelector").SetValue("Red");
// Set the shading correction target value for red to 1000
CFloatParameter(nodemap, "BslShadingCorrectionTargetValue").SetValue(1.0000);
// Set the shading correction target selector to green
CEnumParameter(nodemap, "BslShadingCorrectionTargetSelector").SetValue("Green");
// Set the shading correction target value for green to 1000
CFloatParameter(nodemap, "BslShadingCorrectionTargetValue").SetValue(1.0000);
// Set the shading correction target selector to blue
CEnumParameter(nodemap, "BslShadingCorrectionTargetSelector").SetValue("Blue");
// Set the shading correction target value for blue to 1000
CFloatParameter(nodemap, "BslShadingCorrectionTargetValue").SetValue(1.0000);

// Note: Valid for DSNU and PRNU:
// Create new shading correction data for the shading correction set selected
CCommandParameter(nodemap, "BslShadingCorrectionSetCreate").Execute();
// Get the status of the shading correction set selected
String_t setStatus = CEnumParameter(nodemap, "BslShadingCorrectionSetStatus").GetValue();
// Set the type of shading correction to DSNU
camera.Parameters[PLCamera.BslShadingCorrectionSelector].SetValue(PLCamera.BslShadingCorrectionSelector.DSNU);
// Or for PRNU: Set the type of shading correction to PRNU
camera.Parameters[PLCamera.BslShadingCorrectionSelector].SetValue(PLCamera.BslShadingCorrectionSelector.PRNU);

// Note: Valid for DSNU and PRNU:
// Set the shading correction mode to User
camera.Parameters[PLCamera.BslShadingCorrectionMode].SetValue(PLCamera.BslShadingCorrectionMode.User);
// Set the desired index number of the set to be created
camera.Parameters[PLCamera.BslShadingCorrectionSetIndex].SetValue(1);
// Set the shading correction ROI selector to ROI 1
camera.Parameters[PLCamera.BslShadingCorrectionROISelector].SetValue(PLCamera.BslShadingCorrectionROISelector.ROI1);
// Set the offset X of the ROI to 0
camera.Parameters[PLCamera.BslShadingCorrectionROIOffsetX].SetValue(0);
// Set the ROI width to 2048
camera.Parameters[PLCamera.BslShadingCorrectionROIWidth].SetValue(2048);

// Note: Valid for PRNU only:
// Set the shading correction target selector to red
camera.Parameters[PLCamera.BslShadingCorrectionTargetSelector].SetValue(PLCamera.BslShadingCorrectionTargetSelector.Red);
// Set the shading correction target value for red to 1000
camera.Parameters[PLCamera.BslShadingCorrectionTargetValue].SetValue(1.0000);
// Set the shading correction target selector to green
camera.Parameters[PLCamera.BslShadingCorrectionTargetSelector].SetValue(PLCamera.BslShadingCorrectionTargetSelector.Green);
// Set the shading correction target value for green to 1000
camera.Parameters[PLCamera.BslShadingCorrectionTargetValue].SetValue(1.0000);
// Set the shading correction target selector to blue
camera.Parameters[PLCamera.BslShadingCorrectionTargetSelector].SetValue(PLCamera.BslShadingCorrectionTargetSelector.Blue);
// Set the shading correction target value for blue to 1000
camera.Parameters[PLCamera.BslShadingCorrectionTargetValue].SetValue(1.0000);

// Note: Valid for DSNU and PRNU:
// Create new shading correction data for the shading correction set selected
camera.Parameters[PLCamera.BslShadingCorrectionSetCreate].Execute();
// Get the status of the shading correction set selected
string setStatus = camera.Parameters[PLCamera.BslShadingCorrectionSetStatus].GetValue();
/* 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 */
size_t len = 0;
char setStatus_str[64] = {0};
/* Set the type of shading correction to DSNU */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionSelector", "DSNU");
CHECK(errRes);
/* Or for PRNU: Set the type of shading correction to PRNU */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionSelector", "PRNU");
CHECK(errRes);

/* Note: Valid for DSNU and PRNU: */
/* Set the shading correction mode to User */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionMode", "User");
CHECK(errRes);
/* Set the desired index number of the set to be created */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslShadingCorrectionSetIndex", 1);
CHECK(errRes);
/* Set the shading correction ROI selector to ROI 1 */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionROISelector", "ROI1");
CHECK(errRes);
/* Set the offset X of the ROI to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslShadingCorrectionROIOffsetX", 0);
CHECK(errRes);
/* Set the ROI width to 2048 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslShadingCorrectionROIWidth", 2048);
CHECK(errRes);

/* Note: Valid for PRNU only: */
/* Set the shading correction target selector to red */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionTargetSelector", "Red");
CHECK(errRes);
/* Set the shading correction target value for red to 1000 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslShadingCorrectionTargetValue", 1.0000);
CHECK(errRes);
/* Set the shading correction target selector to green */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionTargetSelector", "Green");
CHECK(errRes);
/* Set the shading correction target value for green to 1000 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslShadingCorrectionTargetValue", 1.0000);
CHECK(errRes);
/* Set the shading correction target selector to blue */
errRes = PylonDeviceFeatureFromString(hdev, "BslShadingCorrectionTargetSelector", "Blue");
CHECK(errRes);
/* Set the shading correction target value for blue to 1000 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslShadingCorrectionTargetValue", 1.0000);
CHECK(errRes);

/* Note: Valid for DSNU and PRNU: */
/* Create new shading correction data for the shading correction set selected */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslShadingCorrectionSetCreate");
CHECK(errRes);
/* Get the status of the shading correction set selected */
len = sizeof(setStatus_str);
errRes = PylonDeviceFeatureToString(hdev, "BslShadingCorrectionSetStatus", setStatus_str, &len);
CHECK(errRes);
# Set the type of shading correction to DSNU
camera.BslShadingCorrectionSelector.Value = "DSNU"
# Or for PRNU: Set the type of shading correction to PRNU
camera.BslShadingCorrectionSelector.Value = "PRNU"

# Note: Valid for DSNU and PRNU:
# Set the shading correction mode to User
camera.BslShadingCorrectionMode.Value = "User"
# Set the desired index number of the set to be created
camera.BslShadingCorrectionSetIndex.Value = 1
# Set the shading correction ROI selector to ROI 1
camera.BslShadingCorrectionROISelector.Value = "ROI1"
# Set the offset X of the ROI to 0
camera.BslShadingCorrectionROIOffsetX.Value = 0
# Set the ROI width to 2048
camera.BslShadingCorrectionROIWidth.Value = 2048

# Note: Valid for PRNU only:
# Set the shading correction target selector to red
camera.BslShadingCorrectionTargetSelector.Value = "Red"
# Set the shading correction target value for red to 1000
camera.BslShadingCorrectionTargetValue.Value = 1.0000
# Set the shading correction target selector to green
camera.BslShadingCorrectionTargetSelector.Value = "Green"
# Set the shading correction target value for green to 1000
camera.BslShadingCorrectionTargetValue.Value = 1.0000
# Set the shading correction target selector to blue
camera.BslShadingCorrectionTargetSelector.Value = "Blue"
# Set the shading correction target value for blue to 1000
camera.BslShadingCorrectionTargetValue.Value = 1.0000

# Note: Valid for DSNU and PRNU:
# Create new shading correction data for the shading correction set selected
camera.BslShadingCorrectionSetCreate.Execute()
# Get the status of the shading correction set selected
setStatus = camera.BslShadingCorrectionSetStatus.Value

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