ImageFilters
ImageFilters
applies an ordered pipeline of post‑processing filters to depth‑like grayscale images (RAW8/RAW16). It is currently most useful for ToF depth pipelines and for replaying depth on the host. The node provides median, spatial, speckle, and temporal filtering in a single place. If no filters are configured, it acts as a passthrough.For standard live StereoDepth
pipelines, prefer using the built‑in StereoDepthConfig.PostProcessing
instead of this node (see Notes).How to place it
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 imageFilters = pipeline.create(dai.node.ImageFilters)
Inputs and Outputs
Additional port:inputConfig
— acceptsImageFiltersConfig
messages for runtime configuration
Basic usage
Filter aStereoDepth
disparity stream with a single filter:Python
C++
Python
Python
1with dai.Pipeline() as p:
2 left = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
3 right = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
4 outL = left.requestOutput((640, 400), fps=20)
5 outR = right.requestOutput((640, 400), fps=20)
6
7 stereo = p.create(dai.node.StereoDepth)
8 outL.link(stereo.left)
9 outR.link(stereo.right)
10
11 filters = p.create(dai.node.ImageFilters)
12 filters.setRunOnHost(True) # Required on RVC2
13 filters.build(stereo.disparity) # build without preset
14
15 # Single Spatial filter enabled (all other params default)
16 spatial = dai.node.ImageFilters.SpatialFilterParams()
17 spatial.enable = True
18 filters.initialConfig.filterParams = [spatial]
Presets
dai::ImageFiltersPresetMode
/ dai.ImageFiltersPresetMode
(currently ToF‑tuned presets only):TOF_LOW_RANGE
— stronger temporal + spatial smoothing for ~0.2–2 mTOF_MID_RANGE
— balanced defaults for ~0.2–5 mTOF_HIGH_RANGE
— aggressive persistence + median for longer ranges
- These presets are named and tuned for ToF usage and are optional.
- For general StereoDepth pipelines, prefer defining a custom pipeline (see Basic usage) and adjust parameters to your scene.
Filter parameters
Available parameter types (same models asStereoDepth
post‑processing):MedianFilterParams
—MEDIAN_OFF
,KERNEL_3x3
,KERNEL_5x5
SpatialFilterParams
—enable
,holeFillingRadius
,alpha
,delta
,numIterations
SpeckleFilterParams
—enable
,speckleRange
,differenceThreshold
TemporalFilterParams
—enable
,persistencyMode
,alpha
,delta
Notes
- Supported input types:
RAW8
andRAW16
only. - Median kernel up to 5×5 in this node (7×7 is not accepted).
- On RVC2, device execution is not supported; call
setRunOnHost(True)
. - If no filters are configured, the node acts as a passthrough.
Recommendation for StereoDepth (non‑ToF)
If you are using liveStereoDepth
, rely on its built‑in post‑processing and keep temporal filtering conservative or disabled. Example (Python):Python
Python
Python
1stereo = p.create(dai.node.StereoDepth)
2# … link left/right …
3stereo.initialConfig.postProcessing.temporalFilter.enable = False
4stereo.initialConfig.postProcessing.temporalFilter.delta = 100
Examples of functionality
- Stereo Depth Filters — example of using
ImageFilters
withStereoDepth
disparity output
Reference
class
dai::node::ImageFilters
variable
std::shared_ptr< ImageFiltersConfig > initialConfig
Initial config for image filters.
variable
Node::Input input
Input for image frames to be filtered
variable
Node::Output output
Filtered frame
variable
Node::Input inputConfig
Config to be set for a specific filter
function
std::shared_ptr< ImageFilters > build(Node::Output & input, ImageFiltersPresetMode presetMode)
Build the node.
Parameters
- input: Input for image frames to be filtered
- presetMode: Preset mode for image filters
Returns
Shared pointer to the node
function
std::shared_ptr< ImageFilters > build(ImageFiltersPresetMode presetMode)
Build the node.
Parameters
- presetMode: Preset mode for image filters
Returns
Shared pointer to the node
function
void run()
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
Check if the node is set to run on host
function
void setDefaultProfilePreset(ImageFiltersPresetMode mode)
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.