# Thread: Calculate distance between the phone and object

1. ## Calculate distance between the phone and object

Hi all
Is it possible to calculate distance between the mobile and object in the viewfinder.
I guess it should be possible by using auto focus feature of the camera. Has any one tried ?

Thanks
Kumar

2. ## Re: Calculate distance between the phone and object

Originally Posted by gmkumar2005
Hi all
Is it possible to calculate distance between the mobile and object in the viewfinder.
I guess it should be possible by using auto focus feature of the camera. Has any one tried ?

Thanks
Kumar
There was such an example in the FN Wiki Python section, but we had tested it and it was not working!

3. ## Re: Calculate distance between the phone and object

Originally Posted by gmkumar2005
Is it possible to calculate distance between the mobile and object in the viewfinder. I guess it should be possible by using auto focus feature of the camera.
Well,

... don't know anything about auto focus, but there could be a simple way: calibrate your system beforehands. The "calibrate" means that your object is e.g. 100 pixels wide at distance of 1 meter. Then measure what the width is at 2 meters and create a generic distance calculating algorithm. Most likely it wouldn't be linear, so better check more points...

Please note: you do need to have some fixed element(s). You cannot estimate distance to arbitrary sized/positioned object. As an example: how would you estimate distance to a real car vs. toy car, if you have nothing to tell whether the object is real one or a toy?

Maybe that would work,

--jouni with lots of toy cars around

4. ## Re: Calculate distance between the phone and object

Thanx jouni
Kumar

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•