2

I have calculated field of view

float FOV = camera.activeFormat.videoFieldOfView;

But its the iPhone field of view.

I need to calculate width of object using field of view. How can i calculate either 1) Field of view for particular object or 2)Width of object using Camera

i have below mark in the pic :

Angle AOB =FOV i have

A'O and B'O i have calculated already.

Need to calculate angle A'OB' and using which finally my aim to calculate A'B' (width of object)

enter image description here

Hawk-Eye
  • 400
  • 1
  • 7
  • 23
9to5ios
  • 5,319
  • 2
  • 37
  • 65

2 Answers2

2

You need 3 independent informations about a triangle to characterize it, otherwise you are just describing a class of triangles. Informations can be angles or lengths.

In your case you have two information about triangle OA'B' and one about OAB, so you can't do anything.

If you had more information, as the horizontal % of the screen taken by your object, you could find a relation between FOV and the angle A'OB' you need by multiplication. (X% * FOV= A'OB')

Now if you have A'OB', OA' and OB' you can compute A'B' with trigonometry.

impact27
  • 527
  • 4
  • 15
0

If I'm understanding you correctly, you still need the distance to the object. Once you have that, you have two sides of a triangle, and can now calculate A'OB', as follows:

  1. Let's call A'B'/2 (i.e. the midpoint of A'B'), C'. (OC' is then the distance to the object.)
  2. A'C'O (or B'OC') form a right triangle.
  3. OC'/OA' is equal to the cosine of A'OC'.
  4. If we multiply the arccosine of OC'/OA' by 2, we will end up with the angle A'OB'.
  5. If you just want the length of A'B', things become even simpler. Multiply the square root of (OA' squared minus OC' squared)' by 2, and you'll have the length of A'B'

Does that make sense?