-
Notifications
You must be signed in to change notification settings - Fork 4.9k
SW device depth-units per sensor's DEPTH_UNITS, if set #12196
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
Conversation
Can you elaborate on If a user does
what will be the behavior on the next two cases?
|
|
||
with test.closure( "New frame should pick up DEPTH_UNITS" ): | ||
test.check_approx_abs( df.get_units(), 0.001, 0.00000001 ) | ||
test.check_approx_abs( df.get_distance( 0, 0 ), 26.985, 0.000001 ) |
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.
So the distance did change when setting the depth_units?
Where did you modified it from 0?
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.
From the sensor: we changed the sensor DEPTH_UNITS
(line 35), to the new frame picked it up.
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 will ask again here as my question before was general.
Do we use the depth units in the frame calculation? for some scale factor?
How did you get the 26.985? there is no real sensor here, so this value comes from somewhere and I am missing it..
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: see here.
We do pixel-value * depth-units
, in this case 0x6969 (from sw.py buffer) * 0.001 = 26.985. That's why I changed sw.py to 0x69 -- it was 0x00 before, so would have yielded 0 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.
Now I understand thanks.
Can you add a comment before this check? its not clear as the initialization is done in another file.
What will happen if no depth unit is set? depth will always be zero?
I am not sure its the best default behavior as the user doesnt know he must set it.
What do you think?
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.
Without depth units, there can be no depth. With regular cameras, we take care to set this (it wasn't always a setting), but with software sensors it has to be provided by someone...
Before, it was completely uninitialized with no way to set it at all... I'd say this is an improvement. And again, this is only for the get_distance()
function -- there are other ways to get at the pixel data and calculating depth. I just don't think SW devices saw much use.
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.
(it was uninitialized in the wrappers; in C++ it's part of the structure so visible to all and settable)
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 agree its good to fix in the root.
Only issue is that when user will use without setting the depth unit he we get 0.
Maybe we need to set it to 1? no impact on the pixels by default?
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.
See my comment offline. I do not believe we can or should tell the user what value to put there. It is up to the user to correctly set the data.
The frame takes:
So the first case, if you publish a sw-frame with See the code in software-device.cpp. |
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.
LGTM
Goes along with #12193:
DEPTH_UNITS
set and nodepth_units
are set in the frame (when creating the frame), then the frame will pick up the sensor's depth unitsTracked on [DSO-19246]