Motion and object detection for service/image v1.1



  • Hi, there are a few interesting enhancements for the package egeoffrey-service-image starting from version v1.1.
    First of all it provides motion and object detection capabilities in three different flavours:

    • Motion detection: when the setting detect_motion_threshold is set for a sensor associated to service/image, the module caches the previously acquired image and does a comparison with the new one, ignoring it unless a motion (higher than the configured %) is detected. The job is done by leveraging the cv2 library, hence works also offline.
    • People detection: when the setting detect_people_threshold is set for a sensor associated to service/image, the module ignores the image unless at least the configured number of people are detected. The job is done by leveraging the cv2 library, hence works also offline.
    • Object detection: when the setting detect_object_name is set for a sensor associated to service/image, the module ignores the image unless it contains the detected object. An additional filter on the confidence the object has been identified is provided by the detect_object_threshold setting. The job is done by leveraging the online service provided by https://www.clarifai.com hence an API key is required. This can be obtained after a free registration which provides a good amount of free operations.

    As you can see, the three methods acts as filters (by not saving the image unless the detection is successful), can be enabled individually, are applied one after the other in the order above (so to limit the number of calls to the online service which is the last one) and are applied with an AND logic.
    In a scenario in which you want to be notified only when a motion/people/object is detected, this approach allows to configure a (realtime) alert which triggers every time a new image is saved.
    If none of the parameter above are set, the module behaviour is the same as the v1.0 version, that is the image is retrieved and just saved at every polling cycle.

    As an additional capability, the module is also capable of capturing images posted on a MQTT broker. This scenario is for e.g. webcams which posts to MQTT the images whenever an alert is triggered. To configure a sensor which leverages this capability, configure first MQTT settings in the module's configuration, then associate the sensor to service/image, select push as the type of interaction and set the topic the webcam is publishing the image into.

    As always both the module and the sensors associated to the module can be fully configured through the web interface, without the need to know the specific configuration settings.


Log in to reply