-
Notifications
You must be signed in to change notification settings - Fork 30
Use depth view in object detection #83
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
|
I want to test something before I submit. |
src/camera/CameraUtils.ts
Outdated
| const depthUV = transformRgbToDepthUv(rgbUv, xrDeviceCamera); | ||
| const depthUV = transformRgbToDepthUv( | ||
| rgbUv, | ||
| viewProjectionMatrix.clone().invert(), |
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're currently inverting viewProjectionMatrix both times we use it. For a minor optimization, we could move the line that creates viewProjectionMatrixInverse up and use that so we only invert once.
| this.depthProjectionMatrices[viewId].copy(camera.projectionMatrix); | ||
| this.depthViewMatrices[viewId].copy(camera.matrixWorldInverse); | ||
| } | ||
| this.depthViewProjectionMatrices[viewId].multiplyMatrices( |
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.
One thing to double-check during testing: the depth view-projection matrix currently seems to built as view * projection. Given how it's later passed around and applied as a clip-from-world transform, I wonder if it may need to be the other way around (projection * view)?
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 good catch. Thanks.
1bdf8e1 to
4283965
Compare
|
@nsalminen @ruofeidu Can you review this again? I made tons of changes. You can now change the simulator depth fov. |
4283965 to
a9ba290
Compare
ruofeidu
left a comment
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, thanks Nels for the catch!
Setting matchDepthView to false allows us to use depth without incurring the performance penalty of Chrome reprojecting the depth. Now, we reproject the depth samples when running object detection which should be much faster.
Tested on Moohan only.