Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate height and width of object using camera only in iOS?

Tags:

ios

iphone

camera

I want to calculate Height and width of object using camera. I have tried for finding angle between camera and object in iphone, i think it will help to get object dimensions!

Any suggestions?

Thanks.

like image 391
vinpat Avatar asked Mar 01 '13 09:03

vinpat


1 Answers

The best way of doing this is to use a reference object. That can be a piece of paper or your id card whose actual dimensions are known to you. Place the reference card near to the object whose dimensions you need to calculate. Take snapshot of both. Somehow calculate the number of pixels covered by card whose actual dimensions are known (I used it using openGL in my iOS Application). Then calculate the number of pixels of the object you want to find dimensions. Comparing both values you can device a formula to get height and width of object.

Above is one solution that might help you. Else you need to calculate distance between object and camera (which is not possible with iPhone, as it has only one camera) and then proceed.

like image 192
abdus.me Avatar answered Oct 02 '22 07:10

abdus.me