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

Demosaicing Mode#

Demosaicing Mode 相機功能可讓您變更用於去馬賽克的演算法。

這有助於優化影像品質。

資訊

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

Basler ace U/L 相機還提供一個 DemosaicingMode 參數,但這僅是為了啟用 PGI 集.

使用功能#

為何要使用Demosaicing Mode#

去馬賽克(亦稱去拜耳化)是用來從影像感測器的彩色輸出中生成 RGB 資訊的過程。

Basler 彩色攝影機即使將像素格式設定為拜耳格式,仍會執行去馬賽克處理。這是由於攝影機的內部影像處理所致。

您的相機提供多種去馬賽克方法。預設情況下,系統會根據設定的像素格式自動決定使用哪種方法。

如果自動選取的方法所產生的結果無法滿足您的應用需求,手動調整去馬賽克模式可能會有所幫助。

例如,相機針對拜耳像素格式會自動選用「最近鄰」演算法。此舉旨在確保與舊版韌體的相容性。然而,「單線性」演算法通常能獲得更好的效果。

去馬賽克方法#

可用的去馬賽克方法如下:

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

去馬賽克模式#

提供以下去馬賽克模式:

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

設定去馬賽克處理#

若要變更去馬賽克所採用的方法:

  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 來輕鬆設定參數。