4 posts
• Page **1** of **1**

I am writing an AI for search and rescue and want to know if there is a simple way to check if an object (potentially another plane) is in the aircraft's field of view? I could do it based on coordinates but it would be nicer if the object was detected if the camera could actually see it.

- jamesBG
**Posts:**9**Joined:**Fri May 04, 2018 7:37 am

I don't think so - the only place where the camera field of view is used is inside the rendering pipeline, but you can't really get information from back there, and it also doesn't care about what you think is a relevant object and what is background.

But if you have the coordinates, the check is very easily done using vector geometry - it's essentially just five lines or so.

But if you have the coordinates, the check is very easily done using vector geometry - it's essentially just five lines or so.

- Thorsten
**Posts:**11327**Joined:**Mon Nov 02, 2009 8:33 am

Would you be able to explain the check to me? I was imagining it to be quite complex.

- jamesBG
**Posts:**9**Joined:**Fri May 04, 2018 7:37 am

If you know vector geometry:

* assume you have the view axis vector and the vector from eye to the object

-> normalize both to get unit vectors

* dot them into each other - that's the cosine of the angle between them

-> compare against a threshold, and you can quickly check a round field of view - may already be good enough

* project both into the horizontal plane (set the vertical coordinate to zero, normalize), dot them again - that's the cosine of the horizontal angle

* project both into the same vertical plane. normalize and dot again - that's the cosine of the vertical angle

-> compare these angles against the field of view

If you do not know vector geometry, I'm afraid it's much harder to explain...

* assume you have the view axis vector and the vector from eye to the object

-> normalize both to get unit vectors

* dot them into each other - that's the cosine of the angle between them

-> compare against a threshold, and you can quickly check a round field of view - may already be good enough

* project both into the horizontal plane (set the vertical coordinate to zero, normalize), dot them again - that's the cosine of the horizontal angle

* project both into the same vertical plane. normalize and dot again - that's the cosine of the vertical angle

-> compare these angles against the field of view

If you do not know vector geometry, I'm afraid it's much harder to explain...

- Thorsten
**Posts:**11327**Joined:**Mon Nov 02, 2009 8:33 am

4 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest