Example #1
0
    def process(self):
        thr_exceeded = False
        if self.configured:
            # convert initial image
            pil_img_init = ScanTools.convert_image(self.img_init)

            while not self.exiting:
                countdown = self.cycle_time

                while not self.exiting and countdown > 0:
                    time.sleep(1)
                    countdown -= 1

                if self.exiting:
                    break

                # request cyclic image
                self.request_image.emit()
                self.mutex.lock()
                self.waitCondition.wait(self.mutex, time=3600)
                self.mutex.unlock()

                if self.exiting:
                    break

                # convert cyclic image and compare images
                pil_img_cyclic = ScanTools.convert_image(self.img_cyclic)
                result = ScanTools.compare_images(pil_img_init, pil_img_cyclic)

                self.comparison_done.emit(result)

                if result > self.threshold:
                    thr_exceeded = True
                    break

        self.finished.emit(thr_exceeded)