跳转到内容

Median Filter#

相机的 Median Filter 功能可减少图像中的噪声。

该功能的使用#

一般信息#

中值滤波器是多向的,并采用 3x3 加权,可用于单色和彩色相机。

启用中值滤波器#

MedianFilter 参数设置为 true

示例代码#

// Enable the median filter
camera.MedianFilter.SetValue(true);
// Disable the median filter
camera.MedianFilter.SetValue(false);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the median filter
CBooleanPtr(nodemap.GetNode("MedianFilter"))->SetValue(true);
// Disable the median filter
CBooleanPtr(nodemap.GetNode("MedianFilter"))->SetValue(false);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the median filter
CBooleanParameter(nodemap, "MedianFilter").SetValue(true);
// Disable the median filter
CBooleanParameter(nodemap, "MedianFilter").SetValue(false);
// Enable the median filter
camera.Parameters[PLCamera.MedianFilter].SetValue(true);
// Disable the median filter
camera.Parameters[PLCamera.MedianFilter].SetValue(false);
// Enable the median filter
Pylon.DeviceSetBooleanFeature(hdev, "MedianFilter", true);
// Disable the median filter
Pylon.DeviceSetBooleanFeature(hdev, "MedianFilter", false);
/* 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 the median filter */
errRes = PylonDeviceSetBooleanFeature(hdev, "MedianFilter", 1);
CHECK(errRes);
/* Disable the median filter */
errRes = PylonDeviceSetBooleanFeature(hdev, "MedianFilter", 0);
CHECK(errRes);

您也可以使用 pylon Viewer 轻松设置参数。****