-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix GetDistance() issue for SoftwareDevice in C# #12193
Fix GetDistance() issue for SoftwareDevice in C# #12193
Conversation
My first question when seeing the user's problem was the same:
But:
So, IMO, the fix from @hsuys is technically correct: the user should be able to specify the depth-units per frame, as we allow in C++. However, this should be done in Python, too, and the rest of the wrappers. Furthermore, I believe the broader issue is: what happens if, like up until now, the user couldn't or didn't set this field? I think the proper thing to do is get the sensor from the frame and query it for The latter would also take care of the user's problem, without specific fixes in C# and Python (or other wrappers) -- assuming the user does not need to set the depth-units per frame. |
I wrote a small unit-test and checked: |
@@ -19,7 +19,7 @@ public void AddVideoFrame(SoftwareVideoFrame f) | |||
NativeMethods.rs2_software_sensor_on_video_frame(Handle, f, out error); | |||
} | |||
|
|||
public void AddVideoFrame<T>(T[] pixels, int stride, int bpp, double timestamp, TimestampDomain domain, int frameNumber, VideoStreamProfile profile) | |||
public void AddVideoFrame<T>(T[] pixels, int stride, int bpp, double timestamp, TimestampDomain domain, int frameNumber, VideoStreamProfile profile, float depthUnits = 0.001f) |
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 the default should be 0, not 0.001.
That way, it will check DEPTH_UNITS
after I do my own PR.
We cannot assume to know what units the user uses.
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. Default to 0.
Also added and initialized the depth unit when constructing sw depth frame in the software-device tutorial.
Fix GetDistance() issue for SoftwareDevice in C#
changes:
add depth_units field to type SoftwareVideoFrame and class AddVideoFrame
Tracked on: [DSO-19246]
Original issue: #12170