-
Notifications
You must be signed in to change notification settings - Fork 0
Decoding
After decoding HEVC encoded data to P010LE the Y plane contains the depth map.
Each value is 2 byte unsigned integer with 10 MSB set, 6 LSB as zeroes. It is enough to multiply the value by the Depth Units
to get the distance in meters.
If you need to convert the depth map to point cloud you will need to unproject the points to 3D.
Read the basics in librealsense Projection in RealSense SDK 2.0.
The unprojection code is in librealsense rs2_deproject_pixel_to_point
, this is exactly what you need to do.
It may seem complex but if your camera doesn't use distortion model (like my D435 by default) this simplifies to a few lines of code.
See independent example of unprojection after decoding here.
For unprojection you need to get the camera intrinsics (focal points, principal points) and distortion model. See example.
If the distortion model coefficients are 0 your camera doesn't use distortion model. This simplifies unprojection greatly.
The camera intrinsics are expressed in pixel units and are valid only for the resolution you get them for. Intrinsics scale with resolution but this also depends on factors like changing FOV along changing resolution.
The distortion model doesn't scale with resolution (if your camera uses it).
If you don't know those details it's simplest to read the intrinsics and distortion model directly from the device for the resolution you use.
See examples:
- hardware decoder and unprojector unhvd-native
- hardware decoder, unprojector and renderer UNHVD