Measuring distance with iPhone camera

前端 未结 3 1358
悲&欢浪女
悲&欢浪女 2021-02-20 03:50

How to implement a way to measure distances in real time (video camera?) on the iPhone, like this app that uses a card to compare the size of the card with the actual distance?<

相关标签:
3条回答
  • 2021-02-20 04:17

    Well you do have something for reference, hence the use of the card. Saying that after watching the a video for the app I can't seem it seems too user friendly.

    So you either need a reference of an object that has some known size, or you need to deduct the size from the image. One idea I just had that might help you do it is what the iPhone's 4 flash (I'm sure it's very complicated by it might just work for some stuff).

    Here's what I think.

    When the user wants to measure something, he takes a picture of it, but you're actually taking two separate images, one with flash on, one with flash off. Then you can analyze the lighting differences in the image and the flash reflection to determine the scale of the image. This will only work for close and not too shining objects I guess.

    But that's about the only other way I thought about deducting scale from an image without any fixed objects.

    0 讨论(0)
  • 2021-02-20 04:23

    Another solution may be to use two laser pointers.

    Basically you would shine two laser pointers at, say, a wall in parallel. Then, the further back you go, the beams will look closer and closer together in the video, but they will still remain the same distance apart. Then you can easily come up with some formula to measure the distance based on how far apart the dots are in the photo.

    See this thread for more details: Possible to measure distance with an iPhone and laser pointer?.

    0 讨论(0)
  • 2021-02-20 04:33

    I like Ron Srebro's idea and have thought about something similar -- please share if you get it to work!

    An alternative approach would be to use the auto-focus feature of the camera. Point-and-shoot camera's often have a laser range finder that they use to auto-focus. iPhone doesn't have this and the f-stop is fixed. However, users can change the focus by tapping the camera screen. The phone can also switch between regular and macro focus.
    If the API exposes the current focus settings, maybe there's a way to use this to determine range?

    0 讨论(0)
提交回复
热议问题