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

IR Reflectivity - move setting #8050

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,15 +909,7 @@ namespace rs2

bool option_model::allow_change(float val, std::string& error_message) const
{
// Deny enabling IR Reflectivity on ROI != 20% [RS5-8358]
if ((RS2_OPTION_ENABLE_IR_REFLECTIVITY == opt) && (1.0f == val))
{
if (0.2f != dev->roi_percentage)
{
error_message = "Please set 'VGA' resolution, 'Max Range' preset and 20% ROI before enabling IR Reflectivity";
return false;
}
}
// Place here option restrictions
return true;
}

Expand Down Expand Up @@ -2295,17 +2287,16 @@ namespace rs2
}
_stream_not_alive.reset();

try
try
{
if( ! viewer.is_option_skipped( RS2_OPTION_ENABLE_IR_REFLECTIVITY ) )
auto ds = d->dev.first< depth_sensor >();
if( viewer._support_ir_reflectivity
&& ds.supports( RS2_OPTION_ENABLE_IR_REFLECTIVITY )
&& ds.supports( RS2_OPTION_ENABLE_MAX_USABLE_RANGE )
&& ( ( p.stream_type() == RS2_STREAM_INFRARED )
|| ( p.stream_type() == RS2_STREAM_DEPTH ) ) )
{
auto ds = d->dev.first< depth_sensor >();
if( ds.supports( RS2_OPTION_ENABLE_IR_REFLECTIVITY )
&& ds.supports( RS2_OPTION_ENABLE_MAX_USABLE_RANGE )
&& ( ( p.stream_type() == RS2_STREAM_INFRARED ) || ( p.stream_type() == RS2_STREAM_DEPTH ) ) )
{
_reflectivity = std::unique_ptr< reflectivity >( new reflectivity() );
}
_reflectivity = std::unique_ptr< reflectivity >( new reflectivity() );
}
}
catch(...) {};
Expand Down
13 changes: 7 additions & 6 deletions common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,13 @@ namespace rs2



viewer_model::viewer_model(context &ctx_)
: ppf(*this),
ctx(ctx_),
frameset_alloc(this),
synchronization_enable(true),
zo_sensors(0)
viewer_model::viewer_model( context & ctx_ )
: ppf( *this )
, ctx( ctx_ )
, frameset_alloc( this )
, synchronization_enable( true )
, zo_sensors( 0 )
, _support_ir_reflectivity( false )
{

syncer = std::make_shared<syncer_model>();
Expand Down
1 change: 1 addition & 0 deletions common/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ namespace rs2
std::shared_ptr<updates_model> updates;

std::unordered_set<int> _hidden_options;
bool _support_ir_reflectivity;
private:

void check_permissions();
Expand Down
42 changes: 41 additions & 1 deletion tools/depth-quality/depth-quality-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ namespace rs2
_viewer_model.draw_plane = true;
_viewer_model.synchronization_enable = false;
_viewer_model.support_non_syncronized_mode = false; //pipeline outputs only syncronized frameset

_viewer_model._support_ir_reflectivity = true;
// Hide options from the DQT application
_viewer_model._hidden_options.emplace(RS2_OPTION_ENABLE_MAX_USABLE_RANGE);
_viewer_model._hidden_options.emplace(RS2_OPTION_ENABLE_IR_REFLECTIVITY);
}

bool tool_model::start(ux_window& window)
Expand Down Expand Up @@ -646,6 +647,45 @@ namespace rs2

ImGui::PopStyleColor();
ImGui::PopItemWidth();

try
{
if (_depth_sensor_model)
{
auto && ds = _depth_sensor_model->dev.first< depth_sensor >();
if (ds.supports(RS2_OPTION_ENABLE_IR_REFLECTIVITY))
{
ImGui::SetCursorPosX(col0);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);

bool current_ir_reflectivity_opt
= ds.get_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY);

if (ImGui::Checkbox("IR Reflectivity",
&current_ir_reflectivity_opt))
{
// Deny enabling IR Reflectivity on ROI != 20% [RS5-8358]
if (0.2f == _roi_percent)
ds.set_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY,
current_ir_reflectivity_opt);
else
_error_message
= "Please set 'VGA' resolution, 'Max Range' preset and "
"20% ROI before enabling IR Reflectivity";
}

if (ImGui::IsItemHovered())
{
ImGui::SetTooltip(ds.get_option_description(RS2_OPTION_ENABLE_IR_REFLECTIVITY));
}
}
}
}
catch (const std::exception& e)
{
_error_message = e.what();
}

ImGui::SetCursorPosX(col0);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);

Expand Down