Calculating average depth in a specific region
Dear Community,
currently I use an Intel RealSense L515 and D415 to obtain the depth from a specific point. Then I use this depth information for further calculation. My problem is that the depth value from the specific point is noisy. This means that the value is changing at each frame. I want to reduce this by averaging the depth information by including depth information from the pixels surrounding the specific point. Is there any method in python which I can use for this ?
Thanks
-
Hi Hamid Rezaie Mixing an L515 and D415 together in close proximity would not be recommendable. Whilst multiple 400 Series cameras do not interfere with each other, they can interfere in return with non-400 Series devices that use infrared. L515 cameras are also sensitive to being negatively affected by ambient light and infrared sources.
If you are using the L515 to obtain the fluctuating depth values and are unable to change the L515 for a 400 Series model then you could try setting the L515 to use the Short Range configuration preset. This will reduce the value of the Laser Power and Receiver Gain settings. Lowering the receiver gain should lower the noise from ambient light.
The link below demonstrates Python code for setting the preset on L515. It also highlights code for confidence and noise filtering.
https://github.com/IntelRealSense/librealsense/issues/8619

-
Thanks for your answer.
I don't use D415 and L515 together, I use them separately. So my main question is that I don't want to take the depth-value of one pixel. I want to have a average pixel depth value. Is this code block the code to get the average depth values of a specified region?depth_sensor.set_option(rs.option.noise_filtering, 6)If not, what does this method exactly do? I was not able to find a good documentation for this, what is for example the value 6?
Thanks
-
noise_filtering is an L515-only option that was added in SDK 2.33.1. A reference to it in the 'API Changes' release notes stated that it controlled the edge thresholds for the noise filtering.
https://github.com/IntelRealSense/librealsense/wiki/API-Changes#version-2331
A couple of references within the SDK's operating files add that it controls background noise as well as edges.
Whilst a definition for the number value associated with the instruction was not available, it presumably refers to the magnitude of the noise filtering applied.
You may be able to take the average of neighboring pixels by applying a median filter, as discussed in the 1. Sub Sampling section of Intel's post-processing guide linked to below.
https://dev.intelrealsense.com/docs/depth-post-processing#section-simple-post-processing
If a Decimation Filter post-processing filter is applied then this will contain median filtering. The above guide describes that if the filter is set to a value of '4', for example (out of an available range of 2-8) then it would be "taking the average of a pixel and its 15 nearest neighbors while ignoring zeroes".
Please sign in to leave a comment.
Comments
3 comments