Skip to content

Python Decimation Filter with Aligning Frames #2356

@Inch4Tk

Description

@Inch4Tk
Required Info
Camera Model D435
Firmware Version 05.09.14.00
Operating System & Version Ubuntu 16.04
Kernel Version (Linux Only) 4.15.0-33-generic
Platform PC
SDK Version 2.13.0
Language python
Segment Robot

Issue Description

I am trying to get the decimation filter combined with aligning frames to run, but could not make it work. I did not find any python documentation/issues/examples regarding this. As per this issue #1207 I wanted to first post-process before aligning.

Here is my current code. Everything works fine without using the filter.

# frameset of color and depth
frames = self.pipeline.wait_for_frames()
depth = frames.get_depth_frame()
# Apply filters to depth
depth = self.dec_filter.process(depth)

# TODO: Combine filtered depth with frames
# ????

# Align the depth frame to color frame
aligned_frames = self.align.process(frames)

# Get aligned frames
aligned_depth_frame = aligned_frames.get_depth_frame()
color_frame = aligned_frames.get_color_frame()

# Validate that both frames are valid
if not aligned_depth_frame or not color_frame:
    continue

I thought I figured out a way that could work, but currently the binding is bugged so I don't know if that would work:

#...
depth = self.filter_chain(depth)
list_of_frames = [rs.frame(frames.get_color_frame()), depth]
source = rs.frame_source()
frames = source.allocate_composite_frame(list_of_frames)

# Align the depth frame to color frame
aligned_frames = self.align.process(frames)
#...

Which gives me this:
TypeError: pyrealsense2.frame_source: No constructor defined!

So my question is: Am I on the right track? Or even better, Is there a way to do it without using allocate_composite_frame?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions