Skip to content

Commit

Permalink
Threshold filter default distances modified
Browse files Browse the repository at this point in the history
  • Loading branch information
remibettan committed Mar 4, 2021
1 parent beb2af6 commit 9ee2cb1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
30 changes: 24 additions & 6 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,9 @@ namespace rs2
yuy2rgb(std::make_shared<rs2::gl::yuy_decoder>()),
depth_decoder(std::make_shared<rs2::depth_huffman_decoder>()),
viewer(viewer),
detected_objects(device_detected_objects)
detected_objects(device_detected_objects),
short_range_min_distance(0.05f),
short_range_max_distance(4.0f)
{
supported_options = s->get_supported_options();
restore_processing_block("colorizer", depth_colorizer);
Expand Down Expand Up @@ -1091,6 +1093,22 @@ namespace rs2
model->enable(false);
}

if (shared_filter->is<threshold_filter>())
{
if (s->supports(RS2_CAMERA_INFO_PRODUCT_ID))
{
// using short range for D405
std::string device_pid = s->get_info(RS2_CAMERA_INFO_PRODUCT_ID);
if (device_pid == "0B5B")
{
std::string error_msg;
auto threshold_pb = shared_filter->as<threshold_filter>();
threshold_pb.set_option(RS2_OPTION_MIN_DISTANCE, short_range_min_distance);
threshold_pb.set_option(RS2_OPTION_MAX_DISTANCE, short_range_max_distance);
}
}
}

if (shared_filter->is<hdr_merge>())
{
// processing block will be skipped if the requested option is not supported
Expand Down Expand Up @@ -1123,21 +1141,21 @@ namespace rs2
auto colorizer = std::make_shared<processing_block_model>(
this, "Depth Visualization", depth_colorizer,
[=](rs2::frame f) { return depth_colorizer->colorize(f); }, error_message);
const_effects.push_back(colorizer);
const_effects.push_back(colorizer);


if (s->supports(RS2_CAMERA_INFO_PRODUCT_ID))
{
std::string device_pid = s->get_info(RS2_CAMERA_INFO_PRODUCT_ID);

// using short range for D405
if (device_pid == "0B5B")
{
std::string error_msg;
depth_colorizer->set_option(RS2_OPTION_MIN_DISTANCE, 0.05f);
depth_colorizer->set_option(RS2_OPTION_MAX_DISTANCE, 1.5f);
depth_colorizer->set_option(RS2_OPTION_MIN_DISTANCE, short_range_min_distance);
depth_colorizer->set_option(RS2_OPTION_MAX_DISTANCE, short_range_max_distance);
}
}


ss.str("");
ss << "##" << dev.get_info(RS2_CAMERA_INFO_NAME)
Expand Down
4 changes: 4 additions & 0 deletions common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ namespace rs2
std::vector<std::shared_ptr<processing_block_model>> post_processing;
bool post_processing_enabled = true;
std::vector<std::shared_ptr<processing_block_model>> const_effects;

private:
const float short_range_min_distance;
const float short_range_max_distance;
};

class viewer_model;
Expand Down

0 comments on commit 9ee2cb1

Please sign in to comment.