2

I want to know remotely whether a room is free or not. I mean: somebody is in the room or not. The room has an old Linux server with webcam and microphone.

I could just take a video and record sound and analyze them remotely, but:

  • It would waste my time and bandwidth.
  • It would be creepy. I don't want to know who is in the room or what they are doing: I only want to know if the room is free or not.

It could run for a minute or two, listening for significant sounds and watching for significant motion. Or better, it could run all the time, getting an idea of what background noise/motion is, and output a binary somebody/nobody information every minute. Outputting a graph of activity level would be OK too. By the way, if the light is off then I can be sure 100% that the room is free.

The tool must be command-line and free.

1 Answer 1

1

You can do this with OpenCV in one of several languages but OpenCV 3 has a demo in python called peopledetect.py which would probably be a very good starting point, there are also lots of demos of capturing from the web cam. You could have a modified version of that demo run once every 5 minutes and create a web page with a percentage chance that the room is unoccupied.

Note that the python People Detect demo is only 71 lines long and the python Face Detect which also might be a good starting point is only 73 lines - so you should find them easy to modify.

I would suggest that if the room matches lights off there is a 99% chance that it is unoccupied - someone might be asleep in there - put if people detect detects one or more person then, depending on the number of false positives, there is a near 0 chance that it is empty.

OpenCV is:

  • Free, gratis and Open Source
  • Cross Platform Windows, OS-X, Linux, iOS & Android
  • Has bindings for C++, C, Python 2 & Java
  • The python demos run from the command line and you can output the results to a file or to the command line
  • Is well documented & comes with lots of demo files

If you also need to check for sound in the room there is also a python package called pyAudio with which it would be reasonably simple to record a few seconds of sound and there are lots of on-line examples for processing an audio file for peak detection if the empty room is normally very quiet or you could use frequency analysis to check for the human voice detection range. There is even a python Speech Recognition package that could be a good starting point.

Important Note

If you put something like this in place most countries will require you to have a clear sign on the door &/or in the room indicating that the room is monitored for activity with Video &/or Audio capture.

2
  • Thank you. 1) The webcam only sees a small portion of the room, so combining with sound detection is important, does OpenCV does that? 2) Nobody sleeps in the room, if that was to happen it would be an acceptable false positive.
    – user23632
    Commented May 12, 2016 at 6:21
  • @user23632 - Added some notes of sound detection. Commented May 12, 2016 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.