Board index FlightGear Development Nasal

Ground Object Detection  Topic is solved

Nasal is the scripting language of FlightGear.

Ground Object Detection

Postby jamesBG » Mon Jul 23, 2018 12:42 am

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

Re: Ground Object Detection  

Postby Thorsten » Mon Jul 23, 2018 5:27 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.
Thorsten
 
Posts: 10157
Joined: Mon Nov 02, 2009 8:33 am

Re: Ground Object Detection

Postby jamesBG » Tue Jul 24, 2018 4:29 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

Re: Ground Object Detection

Postby Thorsten » Tue Jul 24, 2018 5:58 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...
Thorsten
 
Posts: 10157
Joined: Mon Nov 02, 2009 8:33 am


Return to Nasal

Who is online

Users browsing this forum: No registered users and 0 guests