Skip to content
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

[Question] How to Downscale My Recorded Frames to a Different Resolution? #13180

Closed
GyaneshW opened this issue Jul 22, 2024 · 3 comments
Closed

Comments

@GyaneshW
Copy link

Required Info
Camera Model D415
Firmware Version 5.16.0.1
Operating System & Version Linux
Kernel Version (Linux Only) 6.9.10-zen1-1-zen
Platform PC
SDK Version 2.55.1

Issue Description

I have recorded a .bag file that includes a stream with a 1280x720 resolution for both color and depth frames. I now require the aligned frames to be at a 640x480 resolution, but the RealSense Viewer does not allow for resolution adjustment of recorded frames. Here's my proposed approach:

Extract the aligned frames at their original 1280x720 resolution.
Subsequently, crop them to the desired 640x480 resolution.
However, I am uncertain if the depth and color frames obtained through this method would be equivalent to those recorded directly at 640x480 resolution. If there are discrepancies, I would appreciate suggestions for alternative methods.

@MartyG-RealSense
Copy link
Collaborator

Hi @Guan9Wu If you are using the RealSense Viewer tool then the 1280x720 frames are already being downsampled. This is because a post-processing filter called the Decimation Filter is enabled by default in the Viewer. When a bag is imported into the Viewer and played back, the Decimation filter is applied to the bag data in real-time.

The default value of the filter is '2', so 1280x720 is downsampled by half to 640x360.

image

However, downsampling the resolution is not the same as cropping it by using a lower resolution directly. Below are images of 1280x720 downsampled to 640x360 (upper image) and 640x480 directly with the Decimation Filter disabled (lower image). You can see a significant reduction in the viewpoint size in the 640x480 image.

1280x720 downsampled

image

640x480 direct

image

It is possible to crop an image in code using a bounding box, though it is a complicated process. A RealSense user at #2016 (comment) approached the problem by using a 'struct' to define minimum and maximum values for X and Y and then getting the point cloud points.

@MartyG-RealSense
Copy link
Collaborator

Hi @Guan9Wu Do you require further assistance with this case, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants