Demosaicing Mode#
這有助於最佳化影像 Quality。
使用此功能#
為什麼要使用 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 的預設方法。 | ||
| Basler PGI | 如果可用,則使用 Basler PGI 演算法進行進階 demosaicing。 | ||
| Nearest Neighbor | 使用來自其中一個最接近像素的資訊。這是 Bayer Pixel Format 的預設方法,並提供與先前韌體版本最佳的相容性。 | ||
| Unilinear | 使用來自其中一個最接近像素或周圍像素的 Arithmetic 平均值之資訊。相較於 Nearest Neighbor demosaicing,邊緣產生的色彩偽影較少。 |
Demosaicing Modes#
提供以下 demosaicing mode:
- Auto:Demosaicing 方法會根據所設定的 Pixel Format 自動決定。
- Manual:Demosaicing 方法可以手動設定。
設定 Demosaicing#
若要變更用於 demosaicing 的方法:
- 將
BslDemosaicingMode參數設為Manual. - 將
BslDemosaicingMethod參數設為所需的 demosaicing method,例如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);
您也可以使用 pylon Viewer 來輕鬆設定參數。