How to get the distance from the camera to an object?

Hello!

I need to get the distance from the camera (AVCaptureDevice) to an object without knowing its real size cause that's what I'm trying to figure out. Right now I based the implementation using AVDepthData. I find a point that corresponds to the object and I find its depth in the depth map. The thing is that attaching AVDepthDataOutput to the capture session causes the dual camera to zoom to 2X (so that the wide focal length matches the tele) and I don't want that. Is there another way to achieve this?

Thank you!

How to get the distance from the camera to an object?
 
 
Q