The distance to the "point of interest" in the autofocus iphone

In iphone, I want to calculate the distance from the camera to the object.

I was wondering, maybe the Active Autofocus iphone camera will give me the distance to the object (attraction)?

Thank you very much in advance.

ps guys, if you think this is impossible plz let me know;)

+6
source share
2 answers

As far as I know, this is not possible - see here for more information on what you can and cannot do. You can tell when the camera is autofocus, but nothing more.

I am sure that there may be additional information that you can get at focus / distance using a private API call, but if you are not worried about getting to the App Store, this is not an option.

This does not mean that there is no other way. Sounds like a good discussion on this topic: Distance using OpenCV (you can compile openCV for iOS!)

+1
source

I study the camera’s ability to measure short distances and not detect anything, but I came up with this shot in the dark. I haven't tried it yet, but the docs make me think this might work:

  • Create and configure AVCaptureDevice representing the camera
  • Via AVCaptureSession grab AVCaptureStillImageOutput
  • From the AVCaptureStillImageOutput object, check the Exif properties for kCGImagePropertyExifSubjectDistance

It's nice to hear if anyone can use such a methodology to make accurate measurements (less than 1 foot).

0
source

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


All Articles