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
Add reflectivity tool to Depth Quality Tool application #7675
Add reflectivity tool to Depth Quality Tool application #7675
Conversation
src/l500/l500-options.cpp
Outdated
{ | ||
if (value == 1.0f) | ||
{ | ||
auto &max_usable_range_option = _l500_depth_dev->get_depth_sensor().get_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this only AFTER we've checked that all the other options are acceptable...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/l500/l500-options.cpp
Outdated
const char * ir_reflectivity_option::get_description() const | ||
{ | ||
|
||
return "IR Reflectivity Tool� calculates the percentage of IR light reflected by the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a symbol �
after Tool
that I don't think should be there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/l500/l500-options.cpp
Outdated
{ | ||
|
||
return "IR Reflectivity Tool� calculates the percentage of IR light reflected by the " | ||
"object and returns to the camera for processing.\n For example, a value of 60% means " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after \n
shouldn't be there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/l500/l500-options.cpp
Outdated
|
||
return "IR Reflectivity Tool� calculates the percentage of IR light reflected by the " | ||
"object and returns to the camera for processing.\n For example, a value of 60% means " | ||
"that 60% of the IR light projected by L515 is reflected by the object and returns " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by L515
-> by the camera
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/types.cpp
Outdated
@@ -447,6 +447,8 @@ namespace librealsense | |||
CASE(SEQUENCE_ID) | |||
CASE(HUMIDITY_TEMPERATURE) | |||
CASE(ENABLE_MAX_USABLE_RANGE) | |||
CASE(NOISE_ESTIMATION) | |||
CASE(ENABLE_IR_REFLECTIVITY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to override this one manually to return Enable IR Reflectivity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cause we want capitalized R in IR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
wrappers/python/pybackend.cpp
Outdated
@@ -182,6 +182,8 @@ PYBIND11_MODULE(NAME, m) { | |||
.value("sequence_id", RS2_OPTION_SEQUENCE_ID) | |||
.value("humidity_temperature", RS2_OPTION_HUMIDITY_TEMPERATURE) | |||
.value("enable_max_usable_range", RS2_OPTION_ENABLE_MAX_USABLE_RANGE) | |||
.value("noise_estimation", RS2_OPTION_NOISE_ESTIMATION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/viewer.h
Outdated
@@ -188,12 +192,13 @@ namespace rs2 | |||
|
|||
std::shared_ptr<updates_model> updates; | |||
|
|||
bool draw_max_usable_range = true; | |||
std::unordered_set<int> _hided_options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_hidden_options
? No such thing as hided
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/model-views.cpp
Outdated
if (_reflectivity_data_collected) | ||
{ | ||
viewer.ref.reset(); | ||
_reflectivity_data_collected = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we make it so the Reflectivity class knows whether data has been collected (essentially, if it's not empty)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can I thought about it too but wasn't sure what I preffer , if you think its better I can change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
common/model-views.cpp
Outdated
viewer.ref.add_input(val, x, y); | ||
_reflectivity_data_collected = true; | ||
|
||
float noise_est = ds.get_option(RS2_OPTION_NOISE_ESTIMATION); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind me -- the noise estimation is now shown in the Viewer? With the temperatures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will add it to the hidden options for the viewer+ DQT since nobody asked for it.
common/model-views.cpp
Outdated
try | ||
{ | ||
pixel_ref = viewer.ref.get_reflectivity(noise_est, max_usable_range, ir_val); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
6396f7d
to
b9c5db1
Compare
common/reflectivity/reflectivity.cpp
Outdated
return false; | ||
} ); | ||
|
||
if (0 == count_valid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed? Why not just use _filt_dist_arr.empty()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
float reflectivity::get_reflectivity(float raw_noise_estimation,float max_usable_range, float ir_val) const | ||
{ | ||
//Calculating STD over time(temporal noise), when there are more than 5 % invalid return high value | ||
std::vector<float> _filt_dist_arr(STD_PERIOD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not _dist_queue.size()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
using namespace rs2; | ||
|
||
|
||
static const int STD_PERIOD = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N_STD_FRAMES
? Period implies time...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
return true; | ||
} | ||
return false; | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
static const int VGA_HALF_WIDTH = 320; | ||
static const int VGA_HALF_HEIGHT = 240; | ||
|
||
static bool is_close_to_zero(float x) { return (std::abs(x) < std::numeric_limits<float>::epsilon()); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
{ | ||
float variance = 0.0f; | ||
for( auto val : _filt_dist_arr ) | ||
variance += pow( val - mean, 2.0f ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we do all this why we're counting count_valid
? Then maybe we don't need to copy to another vector?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as discussed (count_vaid removed)
common/reflectivity/reflectivity.cpp
Outdated
standard_deviation = sqrt( variance ); | ||
} | ||
|
||
//Range is calculated based on position in map(assuming 0 tilt) Distance is just based on plane distance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space between //
and the text, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/model-views.cpp
Outdated
} | ||
catch (...) {}; | ||
if (pixel_ref != -1.0f) | ||
ref_str = to_string() << std::dec << round(pixel_ref * 100) << "%"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move into the try block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/model-views.cpp
Outdated
auto max_usable_range = mur_sensor.get_max_usable_depth_range(); | ||
reflectivity_valid = true; | ||
std::string ref_str = "N/A"; | ||
float pixel_ref = -1.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/model-views.cpp
Outdated
{ | ||
pixel_ref = _reflectivity->get_reflectivity(noise_est, max_usable_range, ir_val); | ||
} | ||
catch (...) {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/model-views.cpp
Outdated
&& 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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we check whether it's skipped here rather than later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
variance += pow( val - mean, 2.0f ); | ||
|
||
variance = variance / _filt_dist_arr.size(); | ||
standard_deviation = sqrt( variance ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a double
conversion, no? Maybe use std::sqrt
...
Make sure no warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
common/reflectivity/reflectivity.cpp
Outdated
static bool is_close_to_zero(float x) { return (std::abs(x) < std::numeric_limits<float>::epsilon()); } | ||
|
||
|
||
reflectivity::reflectivity() : _is_empty(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
b9c5db1
to
0e3a2d3
Compare
Adding reflectivity tool to DQT:
UI:
Note: This PR does not contain all logical conditions for activating IR Reflectivity
Tracked on [RS5-9263]