Closed RarDay closed 3 years ago
Hi @RarDay You can apply a Threshold Filter to set a minimum and maximum depth distance. Data outside of the defined range is excluded from the image. The threshold filter's programming reference for pyrealsense2 is linked to below.
@MartyG-RealSense hmm yes, i find this func but i dont understand where i must put it
<...>
thre = rs.threshold_filter(0.1, 0.7)
try:
frames = pipe.wait_for_frames()
aligned_frames = align.process(frames)
colorized = colorizer.process(aligned_frames)
ply = rs.save_to_ply("1.ply")
ply.set_option(rs.save_to_ply.option_ply_threshold, True)
ply.process(colorized)
<...>
The above script reference about threshold refers to the export of point cloud data to a ply file.
There is very little information available in regard to scripting for implementing a minimum-maximum depth threshold filter in a Python program. The best guidance that I found is in the link below:
https://github.com/IntelRealSense/librealsense/issues/3002#issuecomment-473044109
Hello! I'm interested in a similar application of threshold_filter
and wanted to share my progress. Note: I had stumbled across option_range
, but was unable to implement.
The below application successfully filtered the point cloud to under the configured distance option (1). The units seem to be in meters. I don't know what defines this, but assume it ties back to option.depth_units
. Further, the filter would only accept the frames
type and not a frames.get_depth_frame()
type. I'm still new to rs and cannot explain why.
pc = rs.pointcloud()
points = rs.points()
pipe = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth)
pipe.start(config)
threshold_filter = rs.threshold_filter()
threshold_filter.set_option(rs.option.max_distance, 1)
try:
frames = pipe.wait_for_frames()
frames_filtered = threshold_filter.process(frames)
@acbuynak It's that i found, thanks! If you are interested, I want to take the points of the face and record them in the database to then recognize people. Something like "face recognition".
Thanks so much @acbuynak for sharing your code :)
@acbuynak It's that i found, thanks! If you are interested, I want to take the points of the face and record them in the database to then recognize people. Something like "face recognition".
Hi, did you succeed to remove background and save recorded data (in my case, it's .bag, but can be easily converted to .ply)?
I get pointcloud from my depth camera. And I want to remove extra points that are far away, how do I put a condition in the code?
My code for save pointcloud:
And i have code to remove background: