SDK SDK for iPhone X

I did a few searches and found various examples, documentation on the iPhone X Face ID and how it can be used for various things, such as authentication, animated emojis.

Need to check if there is an API / SDK to get a depth map from iPhone X to the app?

In my opinion, the depth calculation is based on the predicted pattern. This can be used to obtain the depth profile of any object in front of the sensor. (May depend on the texture of the object.)

+5
source share
1 answer

You will need at least the iOS 11.1 SDK in Xcode 9.1 (as in the beta at the time of this writing). At the same time, builtInTrueDepthCamera becomes one of the types of cameras you use to select a capture device:

 let device = AVCaptureDevice.default(.builtInTrueDepthCamera, for: .video, position: .front) 

You can then continue the installation of AVCaptureSession using the TrueDepth camera device and you can use this capture session to record depth information as you can with the rear dual camera on the iPhone 7 Plus and 8 Plus:

  • Enable depth capture for photos using AVCapturePhotoOutput. isDepthDataDeliveryEnabled , then isDepthDataDeliveryEnabled image using AVCapturePhotoSettings. isDepthDataDeliveryEnabled . You can read depthData from the AVCapturePhoto object that you get after capture, or enable embedsDepthDataInPhoto if you just want to start and forget (and later read data from the captured image file).

  • Get a live channel of depth maps using AVCaptureDepthDataOutput . This is similar to video output; instead of writing directly to the movie file, it provides your delegate with a temporary sequence of buffers (or in this case, depth). If you are shooting video at the same time, AVCaptureDataOutputSynchronizer can be convenient for ensuring that along with coordinate maps, depths and color frames.

As the Apple Compatibility Compatibility documentation notes, you need to select builtInTrueDepthCamera to get any of these depth capture options. If you choose the front side of the builtInWideAngleCamera , it will look like any other auto racing camera, capturing only photos and videos.


Just to emphasize: in terms of APIs, depth capture with the TrueDepth front camera on the iPhone X is very similar to depth capture with dual cameras on the back on the iPhone 7 Plus and 8 Plus. Therefore, if you want to delve deeply into how this whole depth capture business works, and what you can do with captured depth information, see WWDC17 Session 507: Depth capture in iPhone Photos .

+7
source

Source: https://habr.com/ru/post/1272107/


All Articles