myhouse-project / myHouse

Home monitoring and automation suite with interactive Slack bot
GNU General Public License v3.0
2 stars 0 forks source link

Webcam object/motion detection #293

Closed user2684 closed 5 years ago

user2684 commented 7 years ago

Reported by: user2684

I've articulated a bit around this kind of hidden feature here: https://sourceforge.net/p/my-house/wiki/faq/#how-can-i-configure-a-motion-detection-alert-for-my-webcams

user2684 commented 7 years ago

Original comment by: core-c

I've been testing the object detection for a few times now, but i never have been able to get a positive recognition of a frontal face or full body (one i've downloaded extra). The values that adjust the sensor are somewhat of a mystery to me. I did check out the origin website, haarcascades (amazing technique), and stuff.. but still no detection. Can you post an image, which will pass the object-detection? (frontalface, with your default settings 1.2, 3, 10, 70) I am testing with multiple photos of faces in front of the webcam, at different distances (sizes). at different camera resolutions, colordepths..

user2684 commented 7 years ago

Original comment by: user2684

Hi, I should have a script to test the settings because I guess they would require some tuning depending on how close/far the face is supposed to be in the picture. I'll look for it and share it here. Thanks!

user2684 commented 7 years ago

Original comment by: user2684

Hi, here in attachment the script for testing the detection settings. Copy it under the myHouse directory together with the pictures and run it with:

 sudo python image_tester.py 1.png 2.png

When a single parameter is provided, it runs object detection only, when two are provided both motion and object detection. Detection parameters can be changed at the beginning of image_tester.py, in the "sensor" object. For object detection, the object when identified is highlighted with a square and the new picture saved into the same directory. Hope this can help twicking the parameters without spending too much time :-)

user2684 commented 7 years ago

Original comment by: user2684

Btw, here's a picture with faces just in case you need it for testing purposes

user2684 commented 7 years ago

Original comment by: core-c

Thank you very much. I will play with this. With Abba success surely comes quickly Sorry for my late reply. I was busy melting lately :S It was too hot to think clearly..

user2684 commented 7 years ago

Original comment by: core-c

Your image_tester makes it a lot easier to test object detection. It's also cool to see the results marked on the output image. haarcascadefrontalfacealt2 is definitely the best filter. It has less trouble detecting faces of people wearing glasses. It can also better handle faces that are turned at a tiny angle (not exactly facing frontal anymore). It is working. cool..

user2684 commented 7 years ago

Original comment by: user2684

Yeah, I run a few tests with the different profiles and haarcascadefrontalfacealt2 worked best for me as well. Not super-accurate but just ok. Also considering object detection is not applying to a video stream but to static pictures, it is already an approximation (what if a face shows up between polling interval). Of course nothing prevent somebody to generate a custom profile but of course having something working most of the times is a good compromise :)

user2684 commented 7 years ago

Original comment by: core-c

Indeed ^^ I have tried the fullbody haarcascase too. The documentation says it's designed for detecting bodies that are front- or back-faced to the camera. Here's one that detects pedestrians. I've tested it and It works much better.., especially if people are not (back)facing the camera. (in other words: when viewed from the side)

Vlada Kucera's pedestrian detection