Extracting a point cloud from AVDepthData

Hi!

I recently discovered this session (https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/streaming_depth_data_from_the_truedepth_camera ) from the WWDC18 and was wondering how one can extract the point cloud from the depth data without using Metal.

My end result is to have the pointcloud as a 3D array which I can save into a .txt file.


Best,
Rico

Replies

You're dealing with depth and color data by frame. If you are using the demo project from the link, you'll just need to process the data on capture image. There are helper functions I've found recently here. Look specifically at UIImage.toByteArrayRGBA(). You'll need to store the results for each frame and then write to a file with the color data. The depth data can be added to it as well.