Search code examples
iosobjective-ccameraaccelerometerios-camera

Height and width of object using camera in iOS


I am working on a small education demo which should measure height and width of the object using iOS camera.

EDIT:

I have a new theory to measure the width of an object.

enter image description here

In above image, if i can get Angle α and Angle ß, i can get width of the unknown side by using trigonometry formulas. I have the values of b1 and b2 already.

OLD:

Right now, i am focusing on measuring length only. As per my knowledge it should be 3 step process.

  1. User snaps one end of the object.
  2. User snaps other end of the object.
  3. User snaps center of the object. (Suggest me a better way for these please)

I get the approximate measurements using above process, but for the 3rd step, in which user snaps the center of the object. I want to show pointer location on screen (as camera overlay) to help user determine the center of the object.

This is how i am doing it right now. enter image description here

How can i draw pointer location for 3rd step?

Note: Please suggest alternative/best way to make it possible. I would love another suggestions. Thanks.!!


Solution

  • First of all I must appreciate your work you have done till now. Another good thing is the way of explaining, salute!!!!!

    After reading of your question, I feel that you dont need code, you can do it. I think you need direction only.

    As per your explanation, you want to record angle of rotation of the device.

    If you want to measure angle of rotation, you have to use compas readings. But compas readings will change if user tild the device. So you have to use accelerometer to measure tilding of device.

    In short you have to make some combination and equation of both compas and accelerometer readings. Use compas to measure angle and use accelerometer to measure tilding of device.

    If you want further information to implement it, you can ask me.

    Hope this will help you....