'3D point cloud from AVDepthData / CVPixelBuffer iOS

i'm new to iOS development so apologies if this is something basic.

I want to create a point cloud having [x, y, z, r, g, b] values using the AVDepthData / CVPixelBuffer data and save it as a ply file.

https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/streaming_depth_data_from_the_truedepth_camera

this official demo visualize what i want but not able to get my head around how to get the [x, y, z, r, g, b] values from AVDepthData / CVPixelBuffer.

Any help would be really appreciated Regards



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source