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

Small optimization in AC plus removal of two annoying repetitive messages in Viewer #7075

Merged
merged 3 commits into from
Aug 11, 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
46 changes: 17 additions & 29 deletions src/algo/depth-to-rgb-calibration/k-to-dsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,28 +238,16 @@ rs2_dsm_params_double k_to_DSM::convert_new_k_to_DSM

for (auto i = 0; i < new_vertices.size(); i++)
{
new_vertices[i].x = new_vertices[i].x / new_vertices[i].z* sc_vertices[i].z;
new_vertices[i].y = new_vertices[i].y / new_vertices[i].z* sc_vertices[i].z;
new_vertices[i].z = new_vertices[i].z / new_vertices[i].z* sc_vertices[i].z;
new_vertices[i].x = new_vertices[i].x / new_vertices[i].z * sc_vertices[i].z;
new_vertices[i].y = new_vertices[i].y / new_vertices[i].z * sc_vertices[i].z;
new_vertices[i].z = new_vertices[i].z / new_vertices[i].z * sc_vertices[i].z;

new_vertices[i].x *= -1;
new_vertices[i].y *= -1;
}

std::vector<double3> projed(new_vertices.size());
std::vector<double> xim_new(new_vertices.size());
std::vector<double> yim_new(new_vertices.size());

for (auto i = 0; i < new_vertices.size(); i++)
{
projed[i].x = new_vertices[i].x*old_k.fx + new_vertices[i].z*old_k.ppx;
projed[i].y = new_vertices[i].y*old_k.fy + new_vertices[i].z*old_k.ppy;
projed[i].z = new_vertices[i].z;

xim_new[i] = projed[i].x / projed[i].z;
yim_new[i] = projed[i].y / projed[i].z;
}
AC_LOG( DEBUG, " new DSM params: " << AC_D_PREC << ac_data_cand <<"; vertices are changed" );
AC_LOG( DEBUG,
" new DSM params: " << AC_D_PREC << ac_data_cand << "; vertices are changed" );
new_dsm_regs = dsm_regs_cand;
return ac_data_cand;
}
Expand Down Expand Up @@ -715,7 +703,7 @@ std::vector<double2> k_to_DSM::convert_norm_vertices_to_los
(
algo_calibration_info const &regs,
algo_calibration_registers const &dsm_regs,
std::vector<double3> vertices,
std::vector< double3 > const & vertices,
convert_norm_vertices_to_los_data* data
)
{
Expand Down Expand Up @@ -835,8 +823,8 @@ std::vector<double2> k_to_DSM::convert_norm_vertices_to_los
}
for (auto i = 0; i < res.size(); i++)
{
res[i].x = (dsm_x[i] + (double)2047) / (double)dsm_regs.EXTLdsmXscale - (double)dsm_regs.EXTLdsmXoffset;
res[i].y = (dsm_y[i] + (double)2047) / (double)dsm_regs.EXTLdsmYscale - (double)dsm_regs.EXTLdsmYoffset;
res[i].x = (dsm_x[i] + 2047.) / (double)dsm_regs.EXTLdsmXscale - (double)dsm_regs.EXTLdsmXoffset;
res[i].y = (dsm_y[i] + 2047.) / (double)dsm_regs.EXTLdsmYscale - (double)dsm_regs.EXTLdsmYoffset;
}
return res;
}
Expand All @@ -852,14 +840,14 @@ double3 k_to_DSM::laser_incident_direction(double2 angle_rad)
return laser_incident_direction;
}

std::vector<double3> k_to_DSM::transform_to_direction(std::vector<double3> vec)
std::vector< double3 > k_to_DSM::transform_to_direction( std::vector< double3 > const & vec )
{
std::vector<double3> res(vec.size());

for (auto i = 0; i < vec.size(); i++)
{
auto norm = sqrt(vec[i].x*vec[i].x + vec[i].y*vec[i].y + vec[i].z*vec[i].z);
res[i] = { vec[i].x / norm, vec[i].y / norm, vec[i].z / norm };
}
return res;
std::vector< double3 > res( vec.size() );

for( auto i = 0; i < vec.size(); i++ )
{
auto norm = sqrt( vec[i].x * vec[i].x + vec[i].y * vec[i].y + vec[i].z * vec[i].z );
res[i] = { vec[i].x / norm, vec[i].y / norm, vec[i].z / norm };
}
return res;
}
4 changes: 2 additions & 2 deletions src/algo/depth-to-rgb-calibration/k-to-dsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ namespace depth_to_rgb_calibration {

std::vector<double2> convert_norm_vertices_to_los(const algo_calibration_info& regs,
const algo_calibration_registers& algo_calibration_registers,
std::vector<double3> vertices,
std::vector<double3> const & vertices,
convert_norm_vertices_to_los_data* data = nullptr);

double3 laser_incident_direction(double2 angle_rad);
std::vector<double3> transform_to_direction(std::vector<double3>);
std::vector< double3 > transform_to_direction( std::vector< double3 > const & );

pre_process_data _pre_process_data;

Expand Down
2 changes: 1 addition & 1 deletion src/frame-archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace librealsense
{
if (pending_frames > 0)
{
LOG_INFO("All frames from stream 0x"
LOG_DEBUG("All frames from stream 0x"
<< std::hex << this << " are now released by the user" << std::dec);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace librealsense
rs2_exception_type exception_type) noexcept
: librealsense_exception(msg, exception_type)
{
LOG_WARNING(msg);
LOG_DEBUG("recoverable_exception: " << msg);
}

bool file_exists(const char* filename)
Expand Down