-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python Decimation Filter with Aligning Frames #2356
Comments
Since 2.16 there is a simpler way to do this.
The idea is to have single |
So I finally had a chance to try it on a realsense device after upgrading to 2.16. But currently this does not seem to work with python: AttributeError: 'pyrealsense2.composite_frame' object has no attribute 'apply_filter'. Is there any other way to apply the decimation filter before applying align? Or possibly another way to rebuild the frameset manually? |
[Realsense Customer Engineering Team Comment] If the decimation filter applied before align, that means the image size is reduce to 1/4. So far, it's not like the current implementation. |
Thanks for your reply @RealSense-Customer-Engineering . Here in this Issue, evp-mp #1207 (comment) explains in point 3 that he recommends applying filters before aligning.
That is why I wanted to do it that way. I also wanted to avoid having to rescale the aligned depth or color image myself to get it aligned again. |
[Realsense Customer Engineering Team Comment] Do you have more suggestions about the implementation in Python? |
@ev-mp #1207 (comment) explains in point 3 that he recommends applying filters before aligning. A python example code is required to have the correct the filters before align. |
Hi |
[Realsense Customer Engineering Team Comment] |
I would also like to see a working python example of alignment and post-processing together. This issue was closed without one being provided. The suggest |
This worked for me when i modified the align-dept2color.py example. both frames come out 640x480 decimate = rs.decimation_filter(8)
align_to = rs.stream.color
align = rs.align(align_to)
# Streaming loop
try:
while True:
# Get frameset of color and depth
frames = pipeline.wait_for_frames()
decimated = decimate.process(frames).as_frameset()
# Align the depth frame to color frame
aligned_frames = align.process(decimated) |
A reference python snippet was provided by @darrell-rg |
This script does work. So the size of frames doesn't change after the decimation filter, is that correct? How about " the Decimation Filter will reduce spatial resolution preserving z-accuracy and performing some rudamentary hole-filling." |
Is there any update on this aspect? I am trying to use the decimation filter specifically to reduce the resolution of the frame - and that seems like the most intuitive use of the filter. But, I am not getting a reduced frame size, I'm just getting the voxels in little grids of 3x3, 4x4, 5x5, etc. As per #10716 (comment), the last line of that opening post says that the frame size should be reduced if the decimation filter is applied AFTER alignment - but I can't get that to work on my system. I get errors a few lines later, in the open3d.geometry.RGBDImage.create_from_color_and_depth() function. |
Can anyone please show me the result(image) after this(applying filter)? |
Hi @Bash226 An animated image in Intel's post-processing guide at the link below shows before (original) and after (post-processing) when applying filters such as Decimation. |
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.
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:
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?
The text was updated successfully, but these errors were encountered: