Skip to content

Commit fef3a4d

Browse files
authored
Merge branch 'development' into pyrealsense2-wheel-script
2 parents d921d8a + 86f3ec9 commit fef3a4d

21 files changed

Lines changed: 2826 additions & 383 deletions

common/min-z-depth-improver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class min_z_depth_improver
2929
~min_z_depth_improver();
3030

3131
// Apply MinZ improvement to the frameset in `f`.
32-
// IR frames are taken from `f` (upstream filters leave them unmodified);
33-
// the depth in `f` is the already-filtered depth from upstream.
32+
// Runs before decimation so depth and IR are at matching full resolution.
3433
// Returns `f` unchanged when MinZ is unavailable or inputs are missing.
3534
rs2::frame apply( rs2::frame f, rs2::frame_source const & src );
3635

common/minz-filter.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#include "min-z-depth-improver.h"
1111

1212
// rs2::filter adapter for min_z_depth_improver.
13-
// Plugs directly into the per-sensor post_processing chain so it can be
14-
// positioned relative to temporal / spatial / hole-filling by the user.
15-
// Upstream depth filters (temporal, spatial) never touch IR frames, so the
16-
// frameset arriving here carries original IR alongside the already-filtered
17-
// depth — exactly what DepthRangeImprover needs.
13+
// Placed first in the per-sensor post_processing chain, before decimation and
14+
// other depth filters, so that depth and IR frames arrive at the same full
15+
// resolution. Decimation reduces depth resolution while leaving IR unchanged,
16+
// which would trigger the resolution-mismatch guard in apply() — running MinZ
17+
// first avoids that.
1818
class minz_filter : public rs2::filter
1919
{
2020
std::shared_ptr< min_z_depth_improver > _improver;

common/stream-model.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,13 +1001,20 @@ namespace rs2
10011001

10021002

10031003
//add_descriptions_for_d500_metadata_fields(descriptions);
1004-
std::string pid = this->dev->dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID);
1005-
if (pid == "0B6B")
1006-
add_d585S_metadata_descriptions(descriptions);
1007-
1008-
std::string connection_type = this->dev->dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE);
1009-
if (connection_type == "DDS")
1010-
add_dds_metadata_descriptions(descriptions);
1004+
std::string pid;
1005+
if (dev)
1006+
{
1007+
pid = dev->dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID);
1008+
if (pid == "0B6B")
1009+
add_d585S_metadata_descriptions(descriptions);
1010+
1011+
if (dev->dev.supports(RS2_CAMERA_INFO_CONNECTION_TYPE))
1012+
{
1013+
std::string connection_type = dev->dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE);
1014+
if (connection_type == "DDS")
1015+
add_dds_metadata_descriptions(descriptions);
1016+
}
1017+
}
10111018

10121019
for (auto i = 0; i < RS2_FRAME_METADATA_COUNT; i++)
10131020
{

common/subdevice-model.cpp

Lines changed: 52 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -118,56 +118,9 @@ namespace rs2
118118

119119
bool const is_rgb_camera = s->is< color_sensor >();
120120

121-
for (auto&& f : s->get_recommended_filters())
122-
{
123-
auto shared_filter = std::make_shared<filter>(f);
124-
auto model = std::make_shared<processing_block_model>(
125-
this, shared_filter->get_info(RS2_CAMERA_INFO_NAME), shared_filter,
126-
[=](rs2::frame f) { return shared_filter->process(f); }, error_message);
127-
128-
if (shared_filter->is<hole_filling_filter>())
129-
model->enable(false);
130-
131-
if (shared_filter->is<sequence_id_filter>())
132-
model->enable(false);
133-
134-
if (shared_filter->is<decimation_filter>())
135-
{
136-
if (is_rgb_camera)
137-
model->enable(false);
138-
}
139-
140-
if( shared_filter->is< rotation_filter >() )
141-
model->enable( false );
142-
143-
if (shared_filter->is<threshold_filter>())
144-
{
145-
if (s->supports(RS2_CAMERA_INFO_PRODUCT_ID))
146-
{
147-
// using short range for D405
148-
std::string device_pid = s->get_info(RS2_CAMERA_INFO_PRODUCT_ID);
149-
if (device_pid == "0B5B")
150-
{
151-
std::string error_msg;
152-
auto threshold_pb = shared_filter->as<threshold_filter>();
153-
threshold_pb.set_option(RS2_OPTION_MIN_DISTANCE, SHORT_RANGE_MIN_DISTANCE);
154-
threshold_pb.set_option(RS2_OPTION_MAX_DISTANCE, SHORT_RANGE_MAX_DISTANCE);
155-
}
156-
}
157-
model->enable( false );
158-
}
159-
160-
if (shared_filter->is<hdr_merge>())
161-
{
162-
// processing block will be skipped if the requested option is not supported
163-
auto supported_options = s->get_supported_options();
164-
if (std::find(supported_options.begin(), supported_options.end(), RS2_OPTION_SEQUENCE_ID) == supported_options.end())
165-
continue;
166-
}
167-
168-
post_processing.push_back(model);
169-
}
170-
121+
// MinZ must run before get_recommended_filters() (decimation, spatial, temporal…).
122+
// Decimation halves depth resolution while leaving IR unchanged; the mismatch would
123+
// trigger the resolution guard in min_z_depth_improver::apply() and silently skip MinZ.
171124
#ifdef BUILD_WITH_MINZ
172125
if( !is_rgb_camera && s->supports( RS2_OPTION_STEREO_BASELINE ) )
173126
{
@@ -177,21 +130,7 @@ namespace rs2
177130
[block]( rs2::frame f ) { return block->process( f ); },
178131
error_message, false );
179132

180-
// D405 (0B5B) and D401 (ABCC): very short baseline, not compatible with MinZ algorithm
181-
static constexpr const char * PID_D405 = "0B5B";
182-
static constexpr const char * PID_D401 = "ABCC";
183-
184-
std::string pid;
185-
if( s->supports( RS2_CAMERA_INFO_PRODUCT_ID ) )
186-
pid = s->get_info( RS2_CAMERA_INFO_PRODUCT_ID );
187-
bool unsupported_model = ( pid == PID_D405 || pid == PID_D401 );
188-
189-
if( unsupported_model )
190-
{
191-
model->available = []() { return false; };
192-
model->unavailable_tooltip = "Not supported on this camera model";
193-
}
194-
else if( !rsutils::rs2_is_cuda_available() )
133+
if( !rsutils::rs2_is_cuda_available() )
195134
{
196135
model->available = []() { return false; };
197136
model->unavailable_tooltip = "MinZ requires CUDA (not detected on this system)";
@@ -241,6 +180,54 @@ namespace rs2
241180
}
242181
#endif
243182

183+
for (auto&& f : s->get_recommended_filters())
184+
{
185+
auto shared_filter = std::make_shared<filter>(f);
186+
auto model = std::make_shared<processing_block_model>(
187+
this, shared_filter->get_info(RS2_CAMERA_INFO_NAME), shared_filter,
188+
[=](rs2::frame f) { return shared_filter->process(f); }, error_message);
189+
190+
if (shared_filter->is<hole_filling_filter>())
191+
model->enable(false);
192+
193+
if (shared_filter->is<sequence_id_filter>())
194+
model->enable(false);
195+
196+
if (shared_filter->is<decimation_filter>())
197+
{
198+
if (is_rgb_camera)
199+
model->enable(false);
200+
}
201+
202+
if( shared_filter->is< rotation_filter >() )
203+
model->enable( false );
204+
205+
if (shared_filter->is<threshold_filter>())
206+
{
207+
if (s->supports(RS2_CAMERA_INFO_PRODUCT_ID))
208+
{
209+
// using short range for D405
210+
std::string device_pid = s->get_info(RS2_CAMERA_INFO_PRODUCT_ID);
211+
if (device_pid == "0B5B")
212+
{
213+
auto threshold_pb = shared_filter->as<threshold_filter>();
214+
threshold_pb.set_option(RS2_OPTION_MIN_DISTANCE, SHORT_RANGE_MIN_DISTANCE);
215+
threshold_pb.set_option(RS2_OPTION_MAX_DISTANCE, SHORT_RANGE_MAX_DISTANCE);
216+
}
217+
}
218+
model->enable( false );
219+
}
220+
221+
if (shared_filter->is<hdr_merge>())
222+
{
223+
// processing block will be skipped if the requested option is not supported
224+
if (std::find(supported_options.begin(), supported_options.end(), RS2_OPTION_SEQUENCE_ID) == supported_options.end())
225+
continue;
226+
}
227+
228+
post_processing.push_back(model);
229+
}
230+
244231
for (auto&& f : s->query_embedded_filters())
245232
{
246233
auto shared_filter = std::make_shared<embedded_filter>(f);

include/librealsense2/rs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern "C" {
2626
#include "h/rs_eth_config.h"
2727

2828
#define RS2_API_MAJOR_VERSION 2
29-
#define RS2_API_MINOR_VERSION 57
29+
#define RS2_API_MINOR_VERSION 58
3030
#define RS2_API_PATCH_VERSION 0
3131
#define RS2_API_BUILD_VERSION 0
3232

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package format="2">
77
<name>librealsense2</name>
88
<!-- The version tag needs to be updated with each new release of librealsense -->
9-
<version>2.57.0</version>
9+
<version>2.58.0</version>
1010
<description>
1111
Library for controlling and capturing data from the Intel(R) RealSense(TM) D400 devices.
1212
</description>

src/media/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ if(BUILD_ROSBAG2)
3333
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_file_format.h"
3434
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_writer.h"
3535
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_writer.cpp"
36+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_reader_base.h"
37+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_reader_base.cpp"
3638
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_reader.h"
3739
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_reader.cpp"
40+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_native_reader.h"
41+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2_native_reader.cpp"
3842
# ROS2 message types for CDR serialization
3943
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/builtin_interfaces/msg/Time.h"
4044
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/builtin_interfaces/msg/Time.cpp"
@@ -48,5 +52,9 @@ if(BUILD_ROSBAG2)
4852
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/Image.cpp"
4953
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/Imu.h"
5054
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/Imu.cpp"
55+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/RegionOfInterest.h"
56+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/RegionOfInterest.cpp"
57+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/CameraInfo.h"
58+
"${CMAKE_CURRENT_LIST_DIR}/ros2/ros2-msg-types/sensor_msgs/msg/CameraInfo.cpp"
5159
)
5260
endif()

0 commit comments

Comments
 (0)