Skip to content

Commit

Permalink
Added API for depth auto calibration.
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/core/advanced_mode.h
  • Loading branch information
aangerma committed Nov 28, 2019
1 parent 968162e commit e89e4d6
Show file tree
Hide file tree
Showing 24 changed files with 1,108 additions and 357 deletions.
15 changes: 12 additions & 3 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,11 +996,14 @@ namespace rs2
auto sensor_profiles = s->get_stream_profiles();
reverse(begin(sensor_profiles), end(sensor_profiles));
rs2_format def_format{ RS2_FORMAT_ANY };
std::pair<int, int> default_resolution;
for (auto&& profile : sensor_profiles)
{
std::stringstream res;
if (auto vid_prof = profile.as<video_stream_profile>())
{
if (profile.is_default())
default_resolution = std::pair<int, int>(vid_prof.width(), vid_prof.height());
res << vid_prof.width() << " x " << vid_prof.height();
push_back_if_not_exists(res_values, std::pair<int, int>(vid_prof.width(), vid_prof.height()));
push_back_if_not_exists(resolutions, res.str());
Expand Down Expand Up @@ -1053,7 +1056,7 @@ namespace rs2
}

int fps_constrain = usb2 ? 15 : 30;
auto resolution_constrain = usb2 ? std::make_pair(640, 480) : std::make_pair(1280, 720);
auto resolution_constrain = usb2 ? std::make_pair(640, 480) : default_resolution;

// TODO: Once GLSL parts are properly optimised
// and tested on all types of hardware
Expand Down Expand Up @@ -4637,7 +4640,12 @@ namespace rs2
}
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Start on-chip calibration process");
ImGui::SetTooltip( "This will improve the depth noise.\n"
"Point at a scene that normally would have > 50 %% valid depth pixels,\n"
"then press calibrate."
"The health-check will be calculated.\n"
"If >0.25 we recommend applying the new calibration.\n"
"“White wall” mode should only be used when pointing at a flat white wall with projector on");

if (ImGui::Selectable("Tare Calibration"))
{
Expand Down Expand Up @@ -4665,7 +4673,8 @@ namespace rs2
}
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Start on-chip tare calibration process");
ImGui::SetTooltip( "Tare calibration is used to adjust camera absolute distance to flat target.\n"
"User needs to enter the known ground truth");

has_autocalib = true;
}
Expand Down
19 changes: 12 additions & 7 deletions common/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ namespace rs2
draw_text(get_title().c_str(), x, y, height - 35);
}

void rs2::notification_model::draw_dismiss(ux_window & win, int x, int y)
{
ImGui::SetCursorScreenPos({ float(x + width - 105), float(y + height - 25) });

string id = to_string() << "Dismiss" << "##" << index;
if (ImGui::Button(id.c_str(), { 100, 20 }))
{
dismiss(true);
}
}

std::function<void()> notification_model::draw(ux_window& win, int w, int y,
std::shared_ptr<notification_model>& selected, std::string& error_message)
{
Expand Down Expand Up @@ -382,13 +393,7 @@ namespace rs2

if (enable_dismiss)
{
ImGui::SetCursorScreenPos({ float(x + width - 105), float(y + height - 25) });

string id = to_string() << "Dismiss" << "##" << index;
if (ImGui::Button(id.c_str(), { 100, 20 }))
{
dismiss(true);
}
draw_dismiss(win, x, y);
}

unset_color_scheme();
Expand Down
2 changes: 2 additions & 0 deletions common/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace rs2
virtual int calc_height();
virtual void draw_pre_effect(int x, int y) {}
virtual void draw_content(ux_window& win, int x, int y, float t, std::string& error_message);
virtual void draw_dismiss(ux_window& win, int x, int y);
virtual void draw_expanded(ux_window& win, std::string& error_message) {}

virtual void dismiss(bool snooze) { dismissed = true; snoozed = snooze; }
Expand Down Expand Up @@ -139,6 +140,7 @@ namespace rs2

std::shared_ptr<process_manager> update_manager = nullptr;
int update_state = 0;
bool tare = false;
float progress_speed = 5.f;
std::chrono::system_clock::time_point last_progress_time;
int last_progress = 0;
Expand Down
Loading

0 comments on commit e89e4d6

Please sign in to comment.