jeffbass/imagenode

Multiple motion ROI's with one RPi camera

sbkirby opened this issue · 3 comments

Hey Jeff, I hope all is well with you. You mentioned ...it is helpful to specify multiple motion detectors with different ROI's and different thresholds to cover different parts of the imaging area in your settings-yaml.rst doc file. Do you have an example? I've tried a couple of things, but can't seem to get it to work.

Thanks
Stephen

@jeffbass, I may have found a solution. I made the following modification to the function setup_detectors in imaging.py, and I added a '-' in front of each of the 'motion' sections of the yaml file to create a list of detectors (e.g. - motion: ). This should work with both versions of yaml files. I'll continue testing and let you know.

    def setup_detectors(self, detectors, nodename, viewname):
        """ Create a list of detectors for this camera

        Parameters:
            detectors (dict): detectors for this camera from YAML file
            nodename (str): nodename to identify event messages and images sent
            viewnane (str): viewname to identify event messages and images sent
        """

        if isinstance(detectors, (list)):
            for lst in detectors:
                for detector in lst:
                    det = Detector(detector, lst, nodename, viewname)  # create a Detector instance
                    self.detectors.append(det)  # add to list of detectors for this camera
        else:
            for detector in detectors:  # for each camera listed in yaml file
                det = Detector(detector, detectors, nodename, viewname)  # create a Detector instance
                self.detectors.append(det)  # add to list of detectors for this camera

Hi Stephen,
All is well with us; thanks. I'm sorry to I was slow to respond. You've definitely found a bug / design flaw..and I only tested with a motion detector and a light detector on the same camera. I should have tested with 2 motion detectors. Thanks for finding this bug / design flaw. Your solution for having a list of detectors looks like a good one. Let me know how testing goes. And I look forward to learning more about your yaml file and your use case.
Jeff

Thanks for your pull request that solved this. Well done. Closing #17.