Пример #1
0
	def __init__(self, parent, afterCancelCallback=None, afterCalibrationCallback=None):
		Page.__init__(self, parent,
							title=_("Simple Laser Triangulation"),
							subTitle=_("Put the pattern on the platform as shown in the picture and press Calibrate to continue"),
							left=_("Cancel"),
							right=_("Calibrate"),
							buttonLeftCallback=self.onCancel,
							buttonRightCallback=self.onCalibrate,
							panelOrientation=wx.HORIZONTAL,
							viewProgress=True)

		self.driver = Driver.Instance()
		self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
		self.laserTriangulation = calibration.LaserTriangulation.Instance()

		self.afterCancelCallback = afterCancelCallback
		self.afterCalibrationCallback = afterCalibrationCallback

		#-- Image View
		imageView = ImageView(self._panel)
		imageView.setImage(wx.Image(resources.getPathForImage("pattern-position-right.jpg")))

		#-- Video View
		self.videoView = VideoView(self._panel, self.getFrame, 50)
		self.videoView.SetBackgroundColour(wx.BLACK)

		#-- Layout
		self.addToPanel(imageView, 3)
		self.addToPanel(self.videoView, 2)

		#-- Events
		self.Bind(wx.EVT_SHOW, self.onShow)

		self.Layout()
Пример #2
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Scan Parameters"),
                                 hasUndo=False,
                                 hasRestore=False)

        self.driver = Driver.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()
        self.parent = parent
        self.lastScan = profile.getProfileSetting('scan_type')

        self.clearSections()
        section = self.createSection('scan_parameters')
        section.addItem(
            ComboBox,
            'scan_type',
            tooltip=
            _("Simple Scan algorithm captures only the geometry using one image. Texture Scan algorithm captures also the texture using two images"
              ))
        section.addItem(ComboBox, 'use_laser')
        if os.name != 'nt':
            section.addItem(CheckBox, 'fast_scan')
Пример #3
0
    def __init__(self):
        """ """
        self.theta = 0

        self.driver = Driver.Instance()
        self.pcg = PointCloudGenerator.Instance()

        self.run = False
        self.inactive = False
        self.moveMotor = True
        self.generatePointCloud = True

        self.fastScan = False
        self.speedMotor = 200
        self.accelerationMotor = 400

        self.imgType = 'laser'
        self.imgColor = None
        self.imgLaser = None
        self.imgGray = None
        self.imgLine = None

        #TODO: Callbacks to Observer pattern
        self.beforeCallback = None
        self.afterCallback = None

        self.progress = 0
        self.range = 0

        self.imagesQueue = Queue.Queue(100)
        self.points3DQueue = Queue.Queue(1000)
Пример #4
0
    def __init__(self, parent):
        Workbench.__init__(self, parent)

        self.driver = Driver.Instance()

        #-- Toolbar Configuration
        self.connectTool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Connect"),
            wx.Bitmap(resources.getPathForImage("connect.png")),
            shortHelp=_("Connect"))
        self.disconnectTool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Disconnect"),
            wx.Bitmap(resources.getPathForImage("disconnect.png")),
            shortHelp=_("Disconnect"))
        self.toolbar.Realize()

        #-- Disable Toolbar Items
        self.enableLabelTool(self.connectTool, True)
        self.enableLabelTool(self.disconnectTool, False)

        #-- Bind Toolbar Items
        self.Bind(wx.EVT_TOOL, self.onConnectToolClicked, self.connectTool)
        self.Bind(wx.EVT_TOOL, self.onDisconnectToolClicked,
                  self.disconnectTool)

        self.Layout()

        self.videoView = None

        self.Bind(wx.EVT_SHOW, self.onShow)
Пример #5
0
    def __init__(self):
        self.theta = 0
        self.driver = Driver.Instance()

        self.rad = np.pi / 180.0

        self.umin = 0
        self.umax = 960
        self.vmin = 0
        self.vmax = 1280

        self.circleResolution = 30
        self.circleArray = np.array([[
            np.cos(i * 2 * np.pi / self.circleResolution)
            for i in xrange(self.circleResolution)
        ],
                                     [
                                         np.sin(i * 2 * np.pi /
                                                self.circleResolution)
                                         for i in xrange(self.circleResolution)
                                     ],
                                     np.zeros(self.circleResolution)])

        self.rectangleArray = np.array(
            [[0.5, 0.5, -0.5, -0.5], [0.5, -0.5, 0.5, -0.5],
             np.zeros(4)], np.float32)
Пример #6
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Image Acquisition"))

        self.driver = Driver.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()
        self.last_resolution = profile.getProfileSetting('resolution_scanning')

        self.clearSections()
        section = self.createSection('camera_scanning')
        section.addItem(
            Slider,
            'brightness_scanning',
            tooltip=
            _('Image luminosity. Low values are better for environments with high ambient light conditions. High values are recommended for poorly lit places'
              ))
        section.addItem(
            Slider,
            'contrast_scanning',
            tooltip=
            _('Relative difference in intensity between an image point and its surroundings. Low values are recommended for black or very dark colored objects. High values are better for very light colored objects'
              ))
        section.addItem(
            Slider,
            'saturation_scanning',
            tooltip=
            _('Purity of color. Low values will cause colors to disappear from the image. High values will show an image with very intense colors'
              ))
        section.addItem(
            Slider,
            'laser_exposure_scanning',
            tooltip=
            _('Amount of light per unit area. It is controlled by the time the camera sensor is exposed during a frame capture. High values are recommended for poorly lit places'
              ))
        section.addItem(
            Slider,
            'color_exposure_scanning',
            tooltip=
            _('Amount of light per unit area. It is controlled by the time the camera sensor is exposed during a frame capture. High values are recommended for poorly lit places'
              ))
        section.addItem(
            ComboBox,
            'framerate_scanning',
            tooltip=
            _('Number of frames captured by the camera every second. Maximum frame rate is recommended'
              ))
        section.addItem(
            ComboBox,
            'resolution_scanning',
            tooltip=_('Size of the video. Maximum resolution is recommended'))
        section.addItem(
            CheckBox,
            'use_distortion_scanning',
            tooltip=
            _("This option applies lens distortion correction to the video. This process slows the video feed from the camera"
              ))
Пример #7
0
    def __init__(self):
        self.isCalibrating = False
        self.driver = Driver.Instance()

        #TODO: Callbacks to Observer pattern
        self.beforeCallback = None
        self.progressCallback = None
        self.afterCallback = None
Пример #8
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Camera Control"))

        self.driver = Driver.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()

        self.initialize()
Пример #9
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Laser Settings"))

        self.driver = Driver.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()

        self.initialize()
Пример #10
0
    def __init__(self,
                 parent,
                 buttonPrevCallback=None,
                 buttonNextCallback=None):
        WizardPage.__init__(self,
                            parent,
                            title=_("Calibration"),
                            buttonPrevCallback=buttonPrevCallback,
                            buttonNextCallback=buttonNextCallback)

        self.driver = Driver.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()
        self.phase = 'none'

        self.patternLabel = wx.StaticText(
            self.panel,
            label=
            _("Put the pattern on the platform as shown in the picture and press \"Calibrate\""
              ))
        self.patternLabel.Wrap(400)
        self.imageView = ImageView(self.panel)
        self.imageView.setImage(
            wx.Image(resources.getPathForImage("pattern-position-right.jpg")))
        self.calibrateButton = wx.Button(self.panel, label=_("Calibrate"))
        self.cancelButton = wx.Button(self.panel, label=_("Cancel"))
        self.gauge = wx.Gauge(self.panel, range=100, size=(-1, 30))
        self.resultLabel = wx.StaticText(self.panel, size=(-1, 30))

        self.cancelButton.Disable()
        self.resultLabel.Hide()
        self.skipButton.Enable()
        self.nextButton.Disable()

        #-- Layout
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.patternLabel, 0, wx.ALL | wx.CENTER, 5)
        vbox.Add(self.imageView, 1, wx.ALL | wx.EXPAND, 5)
        vbox.Add(self.resultLabel, 0, wx.ALL | wx.CENTER, 5)
        vbox.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.cancelButton, 1, wx.ALL | wx.EXPAND, 5)
        hbox.Add(self.calibrateButton, 1, wx.ALL | wx.EXPAND, 5)
        vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 2)
        self.panel.SetSizer(vbox)

        self.Layout()

        self.calibrateButton.Bind(wx.EVT_BUTTON,
                                  self.onCalibrationButtonClicked)
        self.cancelButton.Bind(wx.EVT_BUTTON, self.onCancelButtonClicked)
        self.Bind(wx.EVT_SHOW, self.onShow)

        self.videoView.setMilliseconds(20)
        self.videoView.setCallback(self.getFrame)
Пример #11
0
    def __init__(self, parent, buttonStartCallback):
        CalibrationPanel.__init__(self, parent, titleText=_("Camera Intrinsics"), buttonStartCallback=buttonStartCallback,
                                  description=_("Determines the camera matrix and the distortion coefficients using Zhang2000 algorithm and pinhole camera model."))

        self.driver = Driver.Instance()
        self.pcg = scan.PointCloudGenerator.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()

        cameraPanel = wx.Panel(self.content)
        distortionPanel = wx.Panel(self.content)

        cameraText = wx.StaticText(self.content, label=_("Camera matrix"))
        cameraText.SetFont((wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_NORMAL)))

        self.cameraTexts = [[0.0 for j in range(3)] for i in range(3)]
        self.cameraValues = np.zeros((3,3))

        cameraBox = wx.BoxSizer(wx.VERTICAL)
        cameraPanel.SetSizer(cameraBox)
        for i in range(3):
            ibox = wx.BoxSizer(wx.HORIZONTAL)
            for j in range(3):
                jbox = wx.BoxSizer(wx.VERTICAL)
                self.cameraTexts[i][j] = wx.TextCtrl(cameraPanel, wx.ID_ANY, "")
                self.cameraTexts[i][j].SetMinSize((0,-1))
                self.cameraTexts[i][j].SetEditable(False)
                self.cameraTexts[i][j].Disable()
                jbox.Add(self.cameraTexts[i][j], 1, wx.ALL|wx.EXPAND, 2)
                ibox.Add(jbox, 1, wx.ALL|wx.EXPAND, 2)
            cameraBox.Add(ibox, 1, wx.ALL|wx.EXPAND, 2)

        distortionText = wx.StaticText(self.content, label=_("Distortion vector"))
        distortionText.SetFont((wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_NORMAL)))

        self.distortionTexts = [0]*5
        self.distortionValues = np.zeros(5)

        distortionBox = wx.BoxSizer(wx.HORIZONTAL)
        distortionPanel.SetSizer(distortionBox)
        for i in range(5):
            ibox = wx.BoxSizer(wx.HORIZONTAL)
            self.distortionTexts[i] = wx.TextCtrl(distortionPanel, wx.ID_ANY, "")
            self.distortionTexts[i].SetMinSize((0,-1))
            self.distortionTexts[i].SetEditable(False)
            self.distortionTexts[i].Disable()
            ibox.Add(self.distortionTexts[i], 1, wx.ALL|wx.EXPAND, 2)
            distortionBox.Add(ibox, 1, wx.ALL|wx.EXPAND, 2)

        self.parametersBox.Add(cameraText, 0, wx.ALL|wx.EXPAND, 8)
       	self.parametersBox.Add(cameraPanel, 0, wx.ALL|wx.EXPAND, 2)
        self.parametersBox.Add(distortionText, 0, wx.ALL|wx.EXPAND, 8)
       	self.parametersBox.Add(distortionPanel, 0, wx.ALL|wx.EXPAND, 2)

        self.Layout()
Пример #12
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Point Cloud Generation"))

        self.driver = Driver.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()

        self.initialize()
Пример #13
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Motor Control"),
                                 hasUndo=False)

        self.driver = Driver.Instance()

        self.initialize()
Пример #14
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Image Segmentation"))

        self.driver = Driver.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()

        self.initialize()
Пример #15
0
    def __init__(self, parent, buttonPrevCallback=None, buttonNextCallback=None):
        WizardPage.__init__(self, parent,
                            title=_("Connection"),
                            buttonPrevCallback=buttonPrevCallback,
                            buttonNextCallback=buttonNextCallback)

        self.parent = parent
        self.driver = Driver.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.autoCheck = calibration.SimpleLaserTriangulation.Instance()

        self.connectButton = wx.Button(self.panel, label=_("Connect"))
        self.settingsButton = wx.Button(self.panel, label=_("Edit settings"))


        self.patternLabel = wx.StaticText(self.panel, label=_("Put the pattern on the platform as shown in the picture and press \"Auto check\""))
        self.patternLabel.Wrap(400)
        self.imageView = ImageView(self.panel)
        self.imageView.setImage(wx.Image(resources.getPathForImage("pattern-position-right.jpg")))
        self.autoCheckButton = wx.Button(self.panel, label=_("Auto check"))
        self.gauge = wx.Gauge(self.panel, range=100, size=(-1, 30))
        self.resultLabel = wx.StaticText(self.panel, size=(-1, 30))

        self.connectButton.Enable()
        self.settingsButton.Enable()
        self.patternLabel.Disable()
        self.imageView.Disable()
        self.autoCheckButton.Disable()
        self.skipButton.Disable()
        self.nextButton.Disable()
        self.resultLabel.Hide()
        self.enableNext = False

        vbox = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectButton, 1, wx.ALL|wx.EXPAND, 5)
        hbox.Add(self.settingsButton, 1, wx.ALL|wx.EXPAND, 5)
        vbox.Add(hbox, 0, wx.ALL|wx.EXPAND, 2)
        vbox.Add(self.patternLabel, 0, wx.ALL|wx.CENTER, 5)
        vbox.Add(self.imageView, 1, wx.ALL|wx.EXPAND, 5)
        vbox.Add(self.resultLabel, 0, wx.ALL|wx.CENTER, 5)
        vbox.Add(self.gauge, 0, wx.ALL|wx.EXPAND, 5)
        vbox.Add(self.autoCheckButton, 0, wx.ALL|wx.EXPAND, 5)
        self.panel.SetSizer(vbox)

        self.Layout()

        self.connectButton.Bind(wx.EVT_BUTTON, self.onConnectButtonClicked)
        self.settingsButton.Bind(wx.EVT_BUTTON, self.onSettingsButtonClicked)
        self.autoCheckButton.Bind(wx.EVT_BUTTON, self.onAutoCheckButtonClicked)
        self.Bind(wx.EVT_SHOW, self.onShow)

        self.videoView.setMilliseconds(50)
        self.videoView.setCallback(self.getDetectChessboardFrame)
        self.updateStatus(self.driver.isConnected)
Пример #16
0
	def __init__(self, parent, buttonPrevCallback=None, buttonNextCallback=None):
		WizardPage.__init__(self, parent,
							title=_("Connection"),
							buttonPrevCallback=buttonPrevCallback,
							buttonNextCallback=buttonNextCallback)

		self.parent = parent
		self.driver = Driver.Instance()
		self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
		self.autoCheck = calibration.SimpleLaserTriangulation.Instance()

		self.connectButton = wx.Button(self.panel, label=_("Connect"))
		luminosity=profile.getProfileSettingObject('luminosity').getType()
		self.luminosityComboBox = wx.ComboBox(self.panel, wx.ID_ANY,
											  value=profile.getProfileSetting('luminosity'),
											  choices=[_(luminosity[0]), _(luminosity[1]), _(luminosity[2])],
											  style=wx.CB_READONLY)
		self.patternLabel = wx.StaticText(self.panel, label=_("Put the pattern on the platform and press \"Auto check\""))
		self.imageView = ImageView(self.panel)
		self.imageView.setImage(wx.Image(resources.getPathForImage("pattern-position-right.jpg")))
		self.autoCheckButton = wx.Button(self.panel, label=_("Auto check"))
		self.gauge = wx.Gauge(self.panel, range=100, size=(-1, 30))
		self.resultLabel = wx.StaticText(self.panel, size=(-1, 30))

		self.connectButton.Enable()
		self.patternLabel.Disable()
		self.imageView.Disable()
		self.autoCheckButton.Disable()
		self.skipButton.Disable()
		self.nextButton.Disable()
		self.resultLabel.Hide()
		self.enableNext = False

		vbox = wx.BoxSizer(wx.VERTICAL)
		hbox = wx.BoxSizer(wx.HORIZONTAL)
		hbox.Add(self.connectButton, 1, wx.ALL|wx.EXPAND, 5)
		hbox.Add(self.luminosityComboBox, 0, wx.ALL|wx.EXPAND, 5)
		vbox.Add(hbox, 0, wx.ALL|wx.EXPAND, 2)
		vbox.Add(self.patternLabel, 0, wx.ALL|wx.CENTER, 5)
		vbox.Add(self.imageView, 1, wx.ALL|wx.EXPAND, 5)
		vbox.Add(self.resultLabel, 0, wx.ALL|wx.CENTER, 5)
		vbox.Add(self.gauge, 0, wx.ALL|wx.EXPAND, 5)
		vbox.Add(self.autoCheckButton, 0, wx.ALL|wx.EXPAND, 5)
		self.panel.SetSizer(vbox)

		self.Layout()

		self.connectButton.Bind(wx.EVT_BUTTON, self.onConnectButtonClicked)
		self.luminosityComboBox.Bind(wx.EVT_COMBOBOX, self.onLuminosityComboBoxChanged)
		self.autoCheckButton.Bind(wx.EVT_BUTTON, self.onAutoCheckButtonClicked)
		self.Bind(wx.EVT_SHOW, self.onShow)

		self.videoView.setMilliseconds(50)
		self.videoView.setCallback(self.getDetectChessboardFrame)
		self.updateStatus(self.driver.isConnected)
Пример #17
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("LDR Value"),
                                 hasUndo=False,
                                 hasRestore=False)

        self.driver = Driver.Instance()

        self.initialize()
Пример #18
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Laser Settings"), hasUndo=False, hasRestore=False)

        self.driver = Driver.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()

        self.clearSections()
        section = self.createSection('laser_settings')
        # section.addItem(Slider, 'laser_threshold_value', self.laserTriangulation.setThreshold)
        section.addItem(ToggleButton, 'left_button')
        section.addItem(ToggleButton, 'right_button')
Пример #19
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("LDR Value"),
                                 hasUndo=False,
                                 hasRestore=False)

        self.driver = Driver.Instance()

        self.clearSections()
        section = self.createSection('ldr_control')
        section.addItem(LDRSection, 'ldr_value')
Пример #20
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Gcode Control"),
                                 hasUndo=False,
                                 hasRestore=False)

        self.driver = Driver.Instance()

        self.clearSections()
        section = self.createSection('gcode_control')
        section.addItem(GcodeSection, 'gcode_gui')
Пример #21
0
    def __init__(self,
                 parent,
                 afterCancelCallback=None,
                 afterCalibrationCallback=None):
        Page.__init__(self,
                      parent,
                      title=_("Camera Intrinsics"),
                      subTitle=_("Press space bar to perform captures"),
                      left=_("Cancel"),
                      right=_("Calibrate"),
                      buttonLeftCallback=self.onCancel,
                      buttonRightCallback=self.onCalibrate,
                      panelOrientation=wx.HORIZONTAL,
                      viewProgress=True)

        self.driver = Driver.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()

        self.afterCancelCallback = afterCancelCallback
        self.afterCalibrationCallback = afterCalibrationCallback

        #-- Video View
        self.videoView = VideoView(self._panel, self.getFrame, 50)
        self.videoView.SetBackgroundColour(wx.BLACK)

        #-- Image Grid Panel
        self.imageGridPanel = wx.Panel(self._panel)
        self.rows, self.columns = 2, 6
        self.panelGrid = []
        self.gridSizer = wx.GridSizer(self.rows, self.columns, 3, 3)
        for panel in xrange(self.rows * self.columns):
            self.panelGrid.append(ImageView(self.imageGridPanel))
            self.panelGrid[panel].Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
            self.panelGrid[panel].SetBackgroundColour((221, 221, 221))
            self.panelGrid[panel].setImage(
                wx.Image(resources.getPathForImage("void.png")))
            self.gridSizer.Add(self.panelGrid[panel], 0, wx.ALL | wx.EXPAND)
        self.imageGridPanel.SetSizer(self.gridSizer)

        #-- Layout
        self.addToPanel(self.videoView, 1)
        self.addToPanel(self.imageGridPanel, 3)

        #-- Events
        self.Bind(wx.EVT_SHOW, self.onShow)
        self.videoView.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
        self.imageGridPanel.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)

        self.videoView.SetFocus()
        self.Layout()
Пример #22
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Rotative Platform"),
                                 hasUndo=False)

        self.driver = Driver.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()

        self.initialize()
Пример #23
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Laser Control"),
                                 hasUndo=False,
                                 hasRestore=False)

        self.driver = Driver.Instance()

        self.clearSections()
        section = self.createSection('laser_control')
        section.addItem(ToggleButton, 'left_button')
        section.addItem(ToggleButton, 'right_button')
Пример #24
0
    def __init__(self, parent):
        super(Wizard, self).__init__(parent,
                                     title="",
                                     size=(640 + 120, 480 + 40))

        self.parent = parent

        self.driver = Driver.Instance()

        self.currentWorkbench = profile.getPreference('workbench')

        self.connectionPage = ConnectionPage(
            self,
            buttonPrevCallback=self.onConnectionPagePrevClicked,
            buttonNextCallback=self.onConnectionPageNextClicked)
        self.calibrationPage = CalibrationPage(
            self,
            buttonPrevCallback=self.onCalibrationPagePrevClicked,
            buttonNextCallback=self.onCalibrationPageNextClicked)
        self.scanningPage = ScanningPage(
            self,
            buttonPrevCallback=self.onScanningPagePrevClicked,
            buttonNextCallback=self.onScanningPageNextClicked)

        pages = [self.connectionPage, self.calibrationPage, self.scanningPage]

        self.connectionPage.intialize(pages)
        self.calibrationPage.intialize(pages)
        self.scanningPage.intialize(pages)

        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

        self.driver.board.setUnplugCallback(
            lambda: wx.CallAfter(self.onBoardUnplugged))
        self.driver.camera.setUnplugCallback(
            lambda: wx.CallAfter(self.onCameraUnplugged))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectionPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.calibrationPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.scanningPage, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(hbox)

        self.Bind(wx.EVT_CLOSE, lambda e: self.onExit())

        self.Centre()
        self.ShowModal()
Пример #25
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Point Cloud Generation"))
        
        self.driver = Driver.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()

        self.clearSections()
        section = self.createSection('point_cloud_generation')
        section.addItem(CheckBox, 'view_roi', tooltip=_("View the Region Of Interest (ROI). This cylindrical region is the one being scanned. All information outside won't be taken into account during the scanning process"))
        section.addItem(Slider, 'roi_diameter')
        section.addItem(Slider, 'roi_height')
        section.addItem(Button, 'point_cloud_color')
Пример #26
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Rotative Platform"), hasUndo=False)
        
        self.driver = Driver.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.main = self.GetParent().GetParent().GetParent().GetParent()

        self.clearSections()
        section = self.createSection('motor_scanning')
        section.addItem(TextBox, 'step_degrees_scanning')
        section.addItem(TextBox, 'feed_rate_scanning')
        section.addItem(TextBox, 'acceleration_scanning')
Пример #27
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self,
                                 parent,
                                 _("Motor Control"),
                                 hasUndo=False)

        self.driver = Driver.Instance()

        self.clearSections()
        section = self.createSection('motor_control')
        section.addItem(TextBox, 'step_degrees_control')
        section.addItem(TextBox, 'feed_rate_control')
        section.addItem(TextBox, 'acceleration_control')
        section.addItem(CallbackButton, 'move_button')
        section.addItem(ToggleButton, 'enable_button')
Пример #28
0
    def __init__(self, parent):
        """"""
        ExpandablePanel.__init__(self, parent, _("Image Segmentation"))
        
        self.driver = Driver.Instance()
        self.pcg = PointCloudGenerator.Instance()
        self.simpleScan = SimpleScan.Instance()
        self.textureScan = TextureScan.Instance()

        self.clearSections()
        section = self.createSection('image_segmentation_simple', None, tag='Simple Scan')
        section.addItem(CheckBox, 'use_cr_threshold', tooltip=_("Threshold is a function used to remove the noise when scanning. It removes a pixel if its intensity is less than the threshold value"))
        section.addItem(Slider, 'cr_threshold_value')
        section = self.createSection('image_segmentation_texture', None, tag='Texture Scan')
        section.addItem(CheckBox, 'use_open', tooltip=_("Open is an operation used to remove the noise when scanning. The higher its value, the lower the noise but also the lower the detail in the image"))
        section.addItem(Slider, 'open_value')
        section.addItem(CheckBox, 'use_threshold', tooltip=_("Threshold is a function used to remove the noise when scanning. It removes a pixel if its intensity is less than the threshold value"))
        section.addItem(Slider, 'threshold_value')
Пример #29
0
    def __init__(self, parent):
        WorkbenchConnection.__init__(self, parent)

        self.driver = Driver.Instance()

        self.load()
Пример #30
0
    def __init__(self):
        super(MainWindow, self).__init__(None, title=_("Horus " + version.getVersion()), size=self.size)

        self.SetMinSize((600, 450))

        ###-- Initialize Engine
        self.driver = Driver.Instance()
        self.simpleScan = scan.SimpleScan.Instance()
        self.textureScan = scan.TextureScan.Instance()
        self.pcg = scan.PointCloudGenerator.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.simpleLaserTriangulation = calibration.SimpleLaserTriangulation.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()

        #-- Serial Name initialization
        serialList = self.serialList()
        currentSerial = profile.getProfileSetting('serial_name')
        if len(serialList) > 0:
            if currentSerial not in serialList:
                profile.putProfileSetting('serial_name', serialList[0])

        #-- Video Id initialization
        videoList = self.videoList()
        currentVideoId = profile.getProfileSetting('camera_id')
        if len(videoList) > 0:
            if currentVideoId not in videoList:
                profile.putProfileSetting('camera_id', videoList[0])

        self.lastFiles = eval(profile.getPreference('last_files'))

        print ">>> Horus " + version.getVersion() + " <<<"

        ###-- Initialize GUI

        ##-- Set Icon
        icon = wx.Icon(resources.getPathForImage("horus.ico"), wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)

        ##-- Status Bar
        #self.CreateStatusBar()

        ##-- Menu Bar
        self.menuBar = wx.MenuBar()

        #--  Menu File
        self.menuFile = wx.Menu()
        self.menuLaunchWizard = self.menuFile.Append(wx.NewId(), _("Launch Wizard"))
        self.menuFile.AppendSeparator()
        self.menuLoadModel = self.menuFile.Append(wx.NewId(), _("Load Model"))
        self.menuSaveModel = self.menuFile.Append(wx.NewId(), _("Save Model"))
        self.menuClearModel = self.menuFile.Append(wx.NewId(), _("Clear Model"))
        self.menuFile.AppendSeparator()
        self.menuOpenProfile = self.menuFile.Append(wx.NewId(), _("Open Profile"), _("Opens Profile .ini"))
        self.menuSaveProfile = self.menuFile.Append(wx.NewId(), _("Save Profile"))
        self.menuResetProfile = self.menuFile.Append(wx.NewId(), _("Reset Profile"))
        self.menuFile.AppendSeparator()
        self.menuExit = self.menuFile.Append(wx.ID_EXIT, _("Exit"))
        self.menuBar.Append(self.menuFile, _("File"))

        #-- Menu Edit
        self.menuEdit = wx.Menu()
        # self.menuBasicMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Basic Mode"))
        # self.menuAdvancedMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Advanced Mode"))
        # self.menuEdit.AppendSeparator()
        self.menuPreferences = self.menuEdit.Append(wx.NewId(), _("Preferences"))
        self.menuMachineSettings = self.menuEdit.Append(wx.NewId(), _("Machine Settings"))
        self.menuBar.Append(self.menuEdit, _("Edit"))

        #-- Menu View
        self.menuView = wx.Menu()
        self.menuControl = wx.Menu()
        self.menuControlPanel = self.menuControl.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuControlVideo = self.menuControl.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Control"), self.menuControl)
        self.menuCalibration = wx.Menu()
        self.menuCalibrationPanel = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuCalibrationVideo = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Calibration"), self.menuCalibration)
        self.menuScanning = wx.Menu()
        self.menuScanningPanel = self.menuScanning.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuScanningVideo = self.menuScanning.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuScanningScene = self.menuScanning.AppendCheckItem(wx.NewId(), _("Scene"))
        self.menuView.AppendMenu(wx.NewId(), _("Scanning"), self.menuScanning)
        self.menuBar.Append(self.menuView, _("View"))

        #-- Menu Help
        self.menuHelp = wx.Menu()
        self.menuWelcome = self.menuHelp.Append(wx.ID_ANY, _("Welcome"))
        if profile.getPreferenceBool('check_for_updates'):
            self.menuUpdates = self.menuHelp.Append(wx.ID_ANY, _("Updates"))
        self.menuWiki = self.menuHelp.Append(wx.ID_ANY, _("Wiki"))
        self.menuSources = self.menuHelp.Append(wx.ID_ANY, _("Sources"))
        self.menuIssues = self.menuHelp.Append(wx.ID_ANY, _("Issues"))
        self.menuForum = self.menuHelp.Append(wx.ID_ANY, _("Forum"))
        self.menuAbout = self.menuHelp.Append(wx.ID_ABOUT, _("About"))
        self.menuBar.Append(self.menuHelp, _("Help"))

        self.SetMenuBar(self.menuBar)

        ##-- Create Workbenchs
        self.controlWorkbench = ControlWorkbench(self)
        self.scanningWorkbench = ScanningWorkbench(self)
        self.calibrationWorkbench = CalibrationWorkbench(self)

        _choices = []
        choices = profile.getProfileSettingObject('workbench').getType()
        for i in choices:
            _choices.append(_(i))
        self.workbenchDict = dict(zip(_choices, choices))

        for workbench in [self.controlWorkbench, self.calibrationWorkbench, self.scanningWorkbench]:
            workbench.combo.Clear()
            for i in choices:
                workbench.combo.Append(_(i))

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.controlWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.calibrationWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.scanningWorkbench, 1, wx.ALL|wx.EXPAND)
        self.SetSizer(sizer)

        ##-- Events
        self.Bind(wx.EVT_MENU, self.onLaunchWizard, self.menuLaunchWizard)
        self.Bind(wx.EVT_MENU, self.onLoadModel, self.menuLoadModel)
        self.Bind(wx.EVT_MENU, self.onSaveModel, self.menuSaveModel)
        self.Bind(wx.EVT_MENU, self.onClearModel, self.menuClearModel)
        self.Bind(wx.EVT_MENU, self.onOpenProfile, self.menuOpenProfile)
        self.Bind(wx.EVT_MENU, self.onSaveProfile, self.menuSaveProfile)
        self.Bind(wx.EVT_MENU, self.onResetProfile, self.menuResetProfile)
        self.Bind(wx.EVT_MENU, self.onExit, self.menuExit)

        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuBasicMode)
        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuAdvancedMode)
        self.Bind(wx.EVT_MENU, self.onPreferences, self.menuPreferences)
        self.Bind(wx.EVT_MENU, self.onMachineSettings, self.menuMachineSettings)

        self.Bind(wx.EVT_MENU, self.onControlPanelClicked, self.menuControlPanel)
        self.Bind(wx.EVT_MENU, self.onControlVideoClicked, self.menuControlVideo)
        self.Bind(wx.EVT_MENU, self.onCalibrationPanelClicked, self.menuCalibrationPanel)
        self.Bind(wx.EVT_MENU, self.onCalibrationVideoClicked, self.menuCalibrationVideo)
        self.Bind(wx.EVT_MENU, self.onScanningPanelClicked, self.menuScanningPanel)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningVideo)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningScene)

        self.Bind(wx.EVT_MENU, self.onAbout, self.menuAbout)
        self.Bind(wx.EVT_MENU, self.onWelcome, self.menuWelcome)
        if profile.getPreferenceBool('check_for_updates'):
            self.Bind(wx.EVT_MENU, self.onUpdates, self.menuUpdates)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/wiki'), self.menuWiki)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus'), self.menuSources)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/issues'), self.menuIssues)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://groups.google.com/forum/?hl=es#!forum/ciclop-3d-scanner'), self.menuForum)

        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.controlWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.calibrationWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.scanningWorkbench.combo)

        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.updateProfileToAllControls()

        x, y, w, h = wx.Display(0).GetGeometry()
        ws, hs = self.size

        self.SetPosition((x+(w-ws)/2., y+(h-hs)/2.))