Noise around segmented object
After trying to segment an object (background removal) by thresholding the distance using:
bg_removed = np.where((depth_image_3d >= depth_image_threshold) | (depth_image_3d <= 0), 0, color_image)
I successfully get a segmented object, but it is not sharp, it has some noise around.
is there something I should consider to improve this?
Hi Fpelegri You could set a visual preset camera configuration to see if it reduces the sharpness of the edges. If you are using Python then a reference for doing so can be found at the link below.
Information about presets is here:
The Default preset can produce cleaner edges, whilst Medium Density can make edges more rounded.
If you are using a RealSense 400 Series camera model that is equipped with a projector, how is the image affected if you disable the projector's IR emitter to turn off its light source?
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
pipeline_profile = pipeline.start(config)
device = pipeline_profile.get_device()
depth_sensor = device.query_sensors()
Thank you. Disabling the IR emitter can have the side-effect of reducing the amount of detail on the depth image, unless the scene is well illuminated so that the camera can make use of that ambient light to aid depth analysis instead. If increasing the illumination in the vicinity of the camera is not an option then having the emitter enabled will be required.
The negative effects on an image of glare from reflections can be negated if a thin-film linear polarizer product is purchased and placed over the left and right camera lenses on the outside of the camera. Any thin-film polarizer that is linear should work, so they are relatively affordable. The circular polarizers used most often in 3D glasses won’t work though. You can search stores such as Amazon for the term linear polarizer sheet
Filters can be attached firmly to the outside of the camera either by 3D-printing a custom-made clip or using a simpler solution such as wrapping rubber bands around the camera to hold the filter on.
If you would prefer to resolve the hole with program scripting, applying a Hole-Filling Filter post-processing filter may be a suitable solution.
Hole-Filling Filter did the job!
Another issue I had was the little speckles on the image, I don't know if there's another filtering parameter on the camera to consider. I can post-process the image and remove them, but as much the camera can do for me, it'd better.
(If you know any suggestion of the speckles, much appreciated! 🙂 )
I tried the 3 options:
The mode numbers are: (Ref link)
- 0 = fill_from_left - "Use the value from the left neighbor pixel to fill the hole"
- 1 = farest_from_around - "Use the value from the neighboring pixel which is furthest away from the sensor"
- 2 = nearest_from_around - "Use the value from the neighboring pixel closest to the sensor"
0 = fill_from_left
1 = farest_from_around
2 = nearest_from_around
Options 1 and 2 are giving me a good result, the option 1 I think is the best fit, also with direct light on it that caused a big hole in it caused by light reflection.
I will explore more depth filter options in order to find the most accurate shape. If I found something much better I'll post it here in order to log it.
Thanks for you help!
Please sign in to leave a comment.