跳至內容
測試伺服器
開發伺服器

Demosaicing Mode#

Demosaicing Mode camera feature 允許您變更用於 demosaicing 的方法。

這有助於最佳化影像 Quality。

資訊

此功能適用於 Basler ace 2、boost R 和 dart R 相機。

Basler ace U/L 相機也提供 DemosaicingMode 參數,但這僅用於啟用 PGI 集.

使用功能#

為什麼使用 Demosaicing Mode#

Demosaicing(也稱為 debayering)的執行是為了從影像感光元件的彩色輸出產生 RGB 資訊。

Basler 彩色相機隨時都會執行 demosaicing,即使 Pixel Format 設定為 Bayer 格式也是如此。這是由於相機內部的影像處理所致。

您的相機提供用於 demosaicing 的 不同方法。預設情況下,該方法是根據設定的 Pixel Format 自動決定。

如果自動選擇的方法所產生的結果無法滿足您的應用需求,手動調整 Demosaicing Mode 將會有所幫助。

例如,相機會針對 Bayer Pixel Format 自動選擇 Nearest Neighbor 方法。這樣做是為了確保與舊版韌體相容。然而,Unilinear 方法通常能達到更好的結果。

去邊緣化方法#

以下提供下列 demosaicing 方法:

Demosaicing Method 描述 適用於非 Bayer Pixel Format 適用於 Bayer Pixel Format
Average Green 使用其中一個最近像素的資訊或周圍綠色像素的 Arithmetic 平均值。如果 Basler PGI 不可用,這是非 Bayer Pixel Format 的預設方法。
巴斯勒PGI 若可用,則採用 Basler 的PGI 演算法進行進階去馬賽克處理。
最近鄰法 使用最鄰近像素之一所提供的資訊。這是拜耳像素格式的預設方法,並能與舊版韌體提供最佳的相容性。
單線性 採用最鄰近像素之一的資訊,或周圍像素的算術平均值。與「最近鄰」去馬賽克演算法相比,邊緣處產生的色彩偽影較少。

Demosaicing Modes#

提供以下去馬賽克模式:

  • 自動:將根據設定的像素格式自動決定去馬賽克方法。
  • 手動:可手動設定去馬賽克方法。

設定 Demosaicing#

若要變更用於去邊緣化 (demosaicing) 的方法:

  1. 將相機中的 BslDemosaicingMode 參數設為 Manual.
  2. 將相機中的 BslDemosaicingMethod 參數設為所需的 去邊緣化方法,例如: 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"

您也可以 use the pylon Viewer 來輕鬆設定參數。