Skip to content

Median Filter#

The Median Filter camera feature allows you to reduce noise in your images.

Using the Feature#

General Information#

The median filter is multi-directional and 3x3 weighted. It can be used on mono and color cameras.

Enabling the Median Filter#

Set the MedianFilter parameter to true.

Sample Code#

// Enable the median filter
camera.MedianFilter.SetValue(true);
// Disable the median filter
camera.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);
/* 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);
# Enable the median filter
camera.MedianFilter.Value = True
# Disable the median filter
camera.MedianFilter.Value = False

You can also use the pylon Viewer to easily set the parameters.