Add RealSense post-processing filters to RSBagReader - #7519
Open
aekanman wants to merge 1 commit into
Open
Conversation
aekanman
force-pushed
the
issue-6164-rsbag-post-processing
branch
from
July 11, 2026 21:08
6d2dca4 to
acc8f3d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds libRealSense depth post-processing support to o3d.t.io.RSBagReader() bag playback, allowing callers to configure an ordered filter chain (e.g., decimation/spatial/temporal/hole-filling) applied before depth-to-color alignment.
Changes:
- Add C++
RSBagReader::Open(filename, filters)API and apply configured filters during playback. - Add Python
RSBagReader.open(filename, filters_dict)overload with dict-to-filter-config conversion and updated docstrings. - Add tutorial documentation, changelog entry, and a Python test covering the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| python/test/t/io/test_realsense.py | Adds a Python test exercising filter configuration during bag playback. |
| docs/tutorial/sensor/realsense.rst | Documents the new filters argument and supported filters/options. |
| cpp/pybind/t/io/sensor.cpp | Adds Python binding overload and dict→C++ filter config conversion. |
| cpp/open3d/t/io/sensor/realsense/RSBagReader.h | Introduces PostProcessingFilter config type and new Open() overload. |
| cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp | Implements filter validation/creation and applies filters before alignment. |
| CHANGELOG.md | Notes the new RSBagReader depth post-processing feature. |
Comment on lines
+30
to
+43
| rs2_option GetPostProcessingOption(const std::string &option_name) { | ||
| static const std::unordered_map<std::string, rs2_option> options = { | ||
| {"filter_magnitude", RS2_OPTION_FILTER_MAGNITUDE}, | ||
| {"filter_smooth_alpha", RS2_OPTION_FILTER_SMOOTH_ALPHA}, | ||
| {"filter_smooth_delta", RS2_OPTION_FILTER_SMOOTH_DELTA}, | ||
| {"holes_fill", RS2_OPTION_HOLES_FILL}, | ||
| }; | ||
| const auto it = options.find(option_name); | ||
| if (it == options.end()) { | ||
| utility::LogError("Unsupported RealSense post-processing option: {}", | ||
| option_name); | ||
| } | ||
| return it->second; | ||
| } |
Comment on lines
+62
to
+79
| rs2::filter MakePostProcessingFilter( | ||
| const RSBagReader::PostProcessingFilter &filter_config) { | ||
| if (filter_config.filter_name_ == "decimation") { | ||
| return ConfigurePostProcessingFilter(rs2::decimation_filter(), | ||
| filter_config); | ||
| } else if (filter_config.filter_name_ == "spatial") { | ||
| return ConfigurePostProcessingFilter(rs2::spatial_filter(), | ||
| filter_config); | ||
| } else if (filter_config.filter_name_ == "temporal") { | ||
| return ConfigurePostProcessingFilter(rs2::temporal_filter(), | ||
| filter_config); | ||
| } else if (filter_config.filter_name_ == "hole_filling") { | ||
| return ConfigurePostProcessingFilter(rs2::hole_filling_filter(), | ||
| filter_config); | ||
| } | ||
| utility::LogError("Unsupported RealSense post-processing filter: {}", | ||
| filter_config.filter_name_); | ||
| } |
Comment on lines
+37
to
+48
| if (!py::isinstance<py::dict>(filter_item.second)) { | ||
| utility::LogError( | ||
| "RealSense post-processing filter '{}' options must be a " | ||
| "dict.", | ||
| filter_config.filter_name_); | ||
| } | ||
| const auto options = | ||
| py::reinterpret_borrow<py::dict>(filter_item.second); | ||
| for (const auto &option_item : options) { | ||
| filter_config.options_[py::cast<std::string>(option_item.first)] = | ||
| py::cast<float>(option_item.second); | ||
| } |
Comment on lines
+84
to
+89
| @pytest.mark.xfail(strict=False, reason="May fail depending on test state.") | ||
| @pytest.mark.skipif(os.getenv('GITHUB_SHA') is not None or | ||
| not hasattr(o3d.t.io, 'RSBagReader'), | ||
| reason="Hangs in Github Actions, succeeds locally or " | ||
| "not built with librealsense") | ||
| def test_RSBagReader_post_processing_filters(): |
| frame is aligned to the color frame. Supported filters are ``decimation``, | ||
| ``spatial``, ``temporal``, and ``hole_filling``. | ||
|
|
||
| .. code-block:: Python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add RealSense post-processing filters to RSBagReader
Type
Motivation and Context
This adds libRealSense depth post-processing support to
o3d.t.io.RSBagReader()playback.RealSense bag playback already reads and aligns depth/color frames, but users could not apply the standard libRealSense depth filters during bag reading. This PR adds an ordered Python
filtersargument toRSBagReader.open()so depth post-processing can be configured before depth is aligned to color. This resolves #6164 by adding libRealSense depth post-processing support too3d.t.io.RSBagReader()playback.Checklist:
python util/check_style.py --applyto apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
Changes:
RSBagReader::Open(filename, filters)for ordered RealSense depth post-processing filters.reader.open(filename, {"decimation": {"filter_magnitude": 2}}).decimation,spatial,temporal, andhole_filling.filter_magnitude,filter_smooth_alpha,filter_smooth_delta, andholes_fill.SampleL515Bag.Test results: