Exemplo n.º 1
0
    def capture(self):
        self.capturing = True
        image = None

        if self.mode == 'Texture':
            image = image_capture.capture_texture()

        if self.mode == 'Pattern':
            image = image_capture.capture_pattern()
            image = image_detection.detect_pattern(image)

        if self.mode == 'Laser':
            image = image_capture.capture_all_lasers()

        if self.mode == 'Gray':
            images = image_capture.capture_lasers()
            for i in xrange(2):
                images[i] = laser_segmentation.compute_line_segmentation(images[i])
            if images[0] is not None and images[1] is not None:
                image = images[0] + images[1]
                image = cv2.merge((image, image, image))
            else:
                image = None

        self.capturing = False
        return image
Exemplo n.º 2
0
 def get_image(self):
     if scanner_autocheck.image is not None:
         image = scanner_autocheck.image
     else:
         image = image_capture.capture_pattern()
         image = image_detection.detect_pattern(image)
     return image
Exemplo n.º 3
0
 def get_image(self):
     if combo_calibration.image is not None:
         image = combo_calibration.image
     else:
         image = image_capture.capture_pattern()
         image = image_detection.detect_pattern(image)
     return image
Exemplo n.º 4
0
    def after_calibration(self, response):
        ret, result = response

        # Flush video
        image_capture.capture_pattern()
        image_capture.capture_pattern()

        if ret:
            dlg = wx.MessageDialog(self, _("Scanner configured correctly"),
                                   _("Success"), wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
        else:
            if isinstance(result, PatternNotDetected):
                dlg = wx.MessageDialog(
                    self,
                    _("Please, put the pattern on the platform. "
                      "Also you can set up the calibration's capture "
                      "settings in the \"Adjustment workbench\" "
                      "until the pattern is detected correctly"), _(result),
                    wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
            elif isinstance(result, WrongMotorDirection):
                dlg = wx.MessageDialog(
                    self,
                    _("Please, select \"Invert the motor direction\" in the preferences"
                      ), _(result), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                self.GetParent().GetParent().launch_preferences(basic=True)
            elif isinstance(result, LaserNotDetected):
                dlg = wx.MessageDialog(
                    self,
                    _("Please, check the lasers connection. "
                      "Also you can set up the calibration's capture and "
                      "segmentation settings in the \"Adjustment workbench\" "
                      "until the lasers are detected correctly"), _(result),
                    wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
        self._initialize()
        self.video_page.right_button.Enable()
        if hasattr(self, 'wait_cursor'):
            del self.wait_cursor
        if self.exit_callback is not None:
            self.exit_callback()
Exemplo n.º 5
0
 def get_image(self):
     if scanner_autocheck.image is not None:
         image = scanner_autocheck.image
     elif laser_triangulation.image is not None:
         image = laser_triangulation.image
     elif platform_extrinsics.image is not None:
         image = platform_extrinsics.image
     else:
         image = image_capture.capture_pattern()
         image = image_detection.detect_pattern(image)
     return image
Exemplo n.º 6
0
 def get_image(self):
     image = image_capture.capture_pattern()
     chessboard = image_detection.detect_pattern(image)
     return chessboard
Exemplo n.º 7
0
 def get_image(self):
     image = image_capture.capture_pattern()
     return image_detection.detect_pattern(image)