Calculate the distance between the iPhone and a do

2019-07-19 05:53发布

I have this scenario:

I know the physical (not only in pixel) size of the screen of the iPhone.

Also I know the width of a door.

Now, if I have the iPhone camera on (with UIImagePicker or whatever), and I am in the position where the width of the door fits perfectly in the width of the camera, and the iPhone stands perfectly vertical, is it possible to know the distance between the iPhone and the door?

1条回答
劫难
2楼-- · 2019-07-19 06:40

It would depend on the camera specs which vary between devices. For this reason I would try to sample some data with a ruler - for instance take a 3' wide plank, align the edges perfectly and measure distance. Do this with varying widths on different devices and you'll have a formula per device (basic algebra)

查看更多
登录 后发表回答