Add reflectivity tool to Depth Quality Tool application - #7675
Conversation
| { | ||
| 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.
I think we should do this only AFTER we've checked that all the other options are acceptable...
| 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.
There's a symbol � after Tool that I don't think should be there
| { | ||
|
|
||
| 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.
Space after \n shouldn't be there
|
|
||
| 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 " |
| CASE(HUMIDITY_TEMPERATURE) | ||
| CASE(ENABLE_MAX_USABLE_RANGE) | ||
| CASE(NOISE_ESTIMATION) | ||
| CASE(ENABLE_IR_REFLECTIVITY) |
There was a problem hiding this comment.
I think you need to override this one manually to return Enable IR Reflectivity
There was a problem hiding this comment.
Cause we want capitalized R in IR ?
| .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) |
| 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.
_hidden_options? No such thing as hided :)
| if (_reflectivity_data_collected) | ||
| { | ||
| viewer.ref.reset(); | ||
| _reflectivity_data_collected = false; |
There was a problem hiding this comment.
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.
We can I thought about it too but wasn't sure what I preffer , if you think its better I can change.
| 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.
Remind me -- the noise estimation is now shown in the Viewer? With the temperatures?
There was a problem hiding this comment.
Yes, I will add it to the hidden options for the viewer+ DQT since nobody asked for it.
| try | ||
| { | ||
| pixel_ref = viewer.ref.get_reflectivity(noise_est, max_usable_range, ir_val); | ||
|
|
6396f7d to
b9c5db1
Compare
| return false; | ||
| } ); | ||
|
|
||
| if (0 == count_valid) |
There was a problem hiding this comment.
Needed? Why not just use _filt_dist_arr.empty()?
| 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); |
| using namespace rs2; | ||
|
|
||
|
|
||
| static const int STD_PERIOD = 100; |
There was a problem hiding this comment.
N_STD_FRAMES? Period implies time...
| return true; | ||
| } | ||
| return false; | ||
| } ); |
| 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()); } |
| { | ||
| float variance = 0.0f; | ||
| for( auto val : _filt_dist_arr ) | ||
| variance += pow( val - mean, 2.0f ); |
There was a problem hiding this comment.
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.
Changed as discussed (count_vaid removed)
| 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.
Space between // and the text, please
| } | ||
| catch (...) {}; | ||
| if (pixel_ref != -1.0f) | ||
| ref_str = to_string() << std::dec << round(pixel_ref * 100) << "%"; |
| 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; |
| { | ||
| pixel_ref = _reflectivity->get_reflectivity(noise_est, max_usable_range, ir_val); | ||
| } | ||
| catch (...) {}; |
| && 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.
Can't we check whether it's skipped here rather than later?
| variance += pow( val - mean, 2.0f ); | ||
|
|
||
| variance = variance / _filt_dist_arr.size(); | ||
| standard_deviation = sqrt( variance ); |
There was a problem hiding this comment.
This is a double conversion, no? Maybe use std::sqrt...
Make sure no warnings.
| static bool is_close_to_zero(float x) { return (std::abs(x) < std::numeric_limits<float>::epsilon()); } | ||
|
|
||
|
|
||
| reflectivity::reflectivity() : _is_empty(false) |
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]