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

Updated OCC part of the RS Viewer #8724

Merged
merged 3 commits into from
Apr 6, 2021
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
26 changes: 10 additions & 16 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ namespace rs2
if (action == RS2_CALIB_ACTION_ON_CHIP_FL_CALIB)
log(to_string() << "Starting focal length calibration");
else if (action == RS2_CALIB_ACTION_ON_CHIP_OB_CALIB)
log(to_string() << "Starting one button calibration");
log(to_string() << "Starting OCC Extended");
else
log(to_string() << "Starting calibration at speed " << speed);
log(to_string() << "Starting OCC at speed " << speed);

_in_3d_view = _viewer.is_3d_view;
_viewer.is_3d_view = (action == RS2_CALIB_ACTION_TARE_GROUND_TRUTH ? false : true);
Expand Down Expand Up @@ -759,7 +759,7 @@ namespace rs2
update_state == RS2_CALIB_STATE_SELF_INPUT)
{
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_OB_CALIB)
ImGui::Text("%s", "On-Chip and Focal Length Calibration");
ImGui::Text("%s", "On-Chip Calibration Extended");
else if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_FL_CALIB)
ImGui::Text("%s", "On-Chip Focal Length Calibration");
else if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_TARE_CALIB)
Expand Down Expand Up @@ -1151,22 +1151,16 @@ namespace rs2
float tmp_y = (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_OB_CALIB ?
float(y + 45 + 3 * ImGui::GetTextLineHeightWithSpacing()) : float(y + 40 + 2 * ImGui::GetTextLineHeightWithSpacing()));
ImGui::SetCursorScreenPos({ float(x + 9), tmp_y });
if (ImGui::RadioButton("OCC All", (int *)&(get_manager().action), 0))
get_manager().action = on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_OB_CALIB;
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", "Both OCC Py/Rx calibration and OCC FL calibration in order");

ImGui::SetCursorScreenPos({ float(x + 6 + width / 3), tmp_y });
if (ImGui::RadioButton("OCC Py/Rx", (int*)&(get_manager().action), 1))
if (ImGui::RadioButton("OCC", (int*)&(get_manager().action), 1))
get_manager().action = on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_CALIB;
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", "On-chip Py/Rx calibration");
ImGui::SetTooltip("%s", "On-Chip Calibration");

ImGui::SetCursorScreenPos({ float(x + 3 + 2 * width / 3), tmp_y });
if (ImGui::RadioButton("OCC FL", (int*)&(get_manager().action), 2))
get_manager().action = on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_FL_CALIB;
ImGui::SetCursorScreenPos({ float(x + 135), tmp_y });
if (ImGui::RadioButton("OCC Extended", (int *)&(get_manager().action), 0))
daversintel marked this conversation as resolved.
Show resolved Hide resolved
get_manager().action = on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_OB_CALIB;
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", "On-chip focal length calibration");
ImGui::SetTooltip("%s", "On-Chip Calibration Extended");

auto sat = 1.f + sin(duration_cast<milliseconds>(system_clock::now() - created_time).count() / 700.f) * 0.1f;
ImGui::PushStyleColor(ImGuiCol_Button, saturate(sensor_header_light_blue, sat));
Expand Down Expand Up @@ -1703,7 +1697,7 @@ namespace rs2
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_FL_CALIB)
title = "On-Chip Focal Length Calibration";
else if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_OB_CALIB)
title = "One Button On-Chip Calibration";
title = "On-Chip Calibration Extended";
else
title = "On-Chip Calibration";
if (update_manager->failed()) title += " Failed";
Expand Down
4 changes: 2 additions & 2 deletions common/on-chip-calib.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ namespace rs2

enum auto_calib_action
{
RS2_CALIB_ACTION_ON_CHIP_OB_CALIB, // One button On-Chip calibration for both
RS2_CALIB_ACTION_ON_CHIP_OB_CALIB, // On-Chip calibration extended
RS2_CALIB_ACTION_ON_CHIP_CALIB, // On-Chip calibration
RS2_CALIB_ACTION_ON_CHIP_FL_CALIB, // On-Chip focal length calibration
RS2_CALIB_ACTION_TARE_CALIB, // Tare calibration
RS2_CALIB_ACTION_TARE_GROUND_TRUTH, // Tare ground truth
};

auto_calib_action action = RS2_CALIB_ACTION_ON_CHIP_OB_CALIB;
auto_calib_action action = RS2_CALIB_ACTION_ON_CHIP_CALIB;
float laser_status_prev = 0.0f;

int fl_step_count = 51;
Expand Down
10 changes: 6 additions & 4 deletions include/librealsense2/h/rs_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,12 @@ void rs2_synthetic_frame_ready(rs2_source* source, rs2_frame* frame, rs2_error**
void rs2_pose_frame_get_pose_data(const rs2_frame* frame, rs2_pose* pose, rs2_error** error);

/**
* Calculate the rectangle size on the specific target
* \param[in] frame Left or right camera frame of size 256x144
* \param[out] rect_sides The four rectangle side sizes in pixels with the order of top, bottom, left, and right
* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
* Extract the target dimensions on the specific target
* \param[in] frame Left or right camera frame of specified size based on the target type
* \param[in] calib_type Calibration target type
* \param[in] target_dims_size Target dimension array size
* \param[out] target_dims The array to hold the result target dimensions calculated. For type RS2_CALIB_TARGET_RECT_GAUSSIAN_DOT_VERTICES, the four rectangle side sizes in pixels with the order of top, bottom, left, and right
* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_extract_target_dimensions(const rs2_frame* frame, rs2_calib_target_type calib_type, float * target_dims, unsigned int target_dims_size, rs2_error** error);

Expand Down
10 changes: 6 additions & 4 deletions include/librealsense2/hpp/rs_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,12 @@ namespace rs2
int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }

/**
* Calculate the rectangle size on the specific target
* \param[in] frame Left or right camera frame of size 256x144
* \param[out] rec_sides The four rectangle side sizes in pixels with the order of top, bottom, left, and right
* \return true if succeeded
* Extract the target dimensions on the specific target
* \param[in] frame Left or right camera frame of specified size based on the target type
* \param[in] calib_type Calibration target type
* \param[in] target_dims_size Target dimension array size
* \param[out] target_dims The array to hold the result target dimensions calculated. For type RS2_CALIB_TARGET_RECT_GAUSSIAN_DOT_VERTICES, the four rectangle side sizes in pixels with the order of top, bottom, left, and right
* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
bool extract_target_dimensions(rs2_calib_target_type calib_type, float* target_dims, unsigned int target_dims_size) const
{
Expand Down