# How do i get the angle of an object in front of my camera?

Hello there,

how can i compute the angle of an object in front of my camera? The resolution of my camera is 1280x1024, the focal length of my lens is 8mm and the pixel size of each pixel on the CMOS is 4.8 micrometer. Surely it must be possible to compute the angle from that. Also i computed the distance of the object to the camera, if thats helpful.

My idea was to use the focal length of the lens in combination with the X-Offset of the detected object from the sensor middle, but i do get weird angles from that.

This is the code for the angle estimation:

```
#first the point X coordinate, second the width of the whole sensor (1280 pixels * 4.8um), third the focal length.
angle = (pointInterpolatedX*6.144)/8
```

Could anybody give me some help here? Thanks!

and how exactly is this related to opencv ?

Well i am using opencv for it..