I would like to reliably detect the presence of a human within a defined radius of a fixed place in a room. Think of a diamond in an art museum — if there's a person within 5 feet of it, I could use the sensor to output a signal as a continuous 1 otherwise 0. Further, would it also work for a half-circle (such as a portrait on the wall in the museum)?
I am currently doing this with OpenCV and a webcam, but there's too much delay > 200 ms in processing. I'm hoping for a better approach that can provide latency < 20 ms.
Best Answer
This should be a relatively simple problem, as much as the comments and answers are saying otherwise. Just to give my background before I go into the answer and also ask more questions, I work with sensors every day to detect positions of objects (humans, or fixed objects).
Going off of your diagrams:
The first solution I would propose is a 2D LiDAR. This is literally what its designed for. There are many, many, many 2D lidars. Ranging from $100 to over $10,000. I personally have this lidar. So if you are just looking at doing this for a school project (not a product), I would go with that lidar, and a raspberry pi. Maybe 4-8 hours of some python code running and you are up and running. This should be almost near real time, with the biggest limitation coming from the OS on the pi, and python vs something like C/C++ (so basically no delays unless you programmed it terribly).
A bit about lidar:
So all you would need to do is say "if lidar returns distance <5ft, there is a person there". The lidar I have and recommended talks over USB but looks like serial data, and there are some open source drivers to connect/read the data from it.
Edit: Also with a 2D lidar you have the ability to detect if there are multiple people/objects. This is exactly how self driving cars and robots (my area of work) detect obstacles. Just with fancier versions of lidars and computers.