Ejemplo n.º 1
0
    def load(self):
        #-- Toolbar Configuration
        self.toolbar.Realize()

        self.scrollPanel = wx.lib.scrolledpanel.ScrolledPanel(self._panel,
                                                              size=(290, -1))
        self.scrollPanel.SetupScrolling(scroll_x=False, scrollIntoView=False)
        self.scrollPanel.SetAutoLayout(1)

        self.controls = ExpandableControl(self.scrollPanel)

        self.controls.addPanel('camera_control', CameraControl(self.controls))
        self.controls.addPanel('laser_control', LaserControl(self.controls))
        self.controls.addPanel('ldr_value', LDRControl(self.controls))
        self.controls.addPanel('motor_control', MotorControl(self.controls))
        self.controls.addPanel('gcode_control', GcodeControl(self.controls))

        self.videoView = VideoView(self._panel, self.getFrame, 10)
        self.videoView.SetBackgroundColour(wx.BLACK)

        #-- Layout
        vsbox = wx.BoxSizer(wx.VERTICAL)
        vsbox.Add(self.controls, 0, wx.ALL | wx.EXPAND, 0)
        self.scrollPanel.SetSizer(vsbox)
        vsbox.Fit(self.scrollPanel)

        self.addToPanel(self.scrollPanel, 0)
        self.addToPanel(self.videoView, 1)

        self.updateCallbacks()
        self.Layout()
Ejemplo n.º 2
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()
Ejemplo n.º 3
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()
Ejemplo n.º 4
0
    def __init__(self,
                 parent,
                 title="Title",
                 buttonPrevCallback=None,
                 buttonNextCallback=None):
        wx.Panel.__init__(self, parent)

        self.title = title
        self.panel = wx.Panel(self)

        self.enableNext = True

        self.buttonPrevCallback = buttonPrevCallback
        self.buttonSkipCallback = buttonNextCallback
        self.buttonNextCallback = buttonNextCallback

        self.videoView = VideoView(self, size=(300, 400))
        self.videoView.SetBackgroundColour(wx.BLACK)
        self.prevButton = wx.Button(self, label=_("Prev"))
        self.skipButton = wx.Button(self, label=_("Skip"))
        self.nextButton = wx.Button(self, label=_("Next"))
Ejemplo n.º 5
0
    def load(self):
        #-- Toolbar Configuration
        self.playTool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Play"),
            wx.Bitmap(resources.getPathForImage("play.png")),
            shortHelp=_("Play"))
        self.stopTool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Stop"),
            wx.Bitmap(resources.getPathForImage("stop.png")),
            shortHelp=_("Stop"))
        self.pauseTool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Pause"),
            wx.Bitmap(resources.getPathForImage("pause.png")),
            shortHelp=_("Pause"))
        self.toolbar.Realize()

        #-- Disable Toolbar Items
        self.enableLabelTool(self.playTool, False)
        self.enableLabelTool(self.stopTool, False)
        self.enableLabelTool(self.pauseTool, False)

        #-- Bind Toolbar Items
        self.Bind(wx.EVT_TOOL, self.onPlayToolClicked, self.playTool)
        self.Bind(wx.EVT_TOOL, self.onStopToolClicked, self.stopTool)
        self.Bind(wx.EVT_TOOL, self.onPauseToolClicked, self.pauseTool)

        self.scrollPanel = wx.lib.scrolledpanel.ScrolledPanel(self._panel,
                                                              size=(290, -1))
        self.scrollPanel.SetupScrolling(scroll_x=False, scrollIntoView=False)
        self.scrollPanel.SetAutoLayout(1)

        self.controls = ExpandableControl(self.scrollPanel)

        self.controls.addPanel('scan_parameters',
                               ScanParameters(self.controls))
        self.controls.addPanel('rotative_platform',
                               RotativePlatform(self.controls))
        self.controls.addPanel('image_acquisition',
                               ImageAcquisition(self.controls))
        self.controls.addPanel('image_segmentation',
                               ImageSegmentation(self.controls))
        self.controls.addPanel('point_cloud_generation',
                               PointCloudGeneration(self.controls))

        self.splitterWindow = wx.SplitterWindow(self._panel)

        self.videoView = VideoView(self.splitterWindow, self.getFrame, 10)
        self.videoView.SetBackgroundColour(wx.BLACK)

        self.scenePanel = wx.Panel(self.splitterWindow)
        self.sceneView = SceneView(self.scenePanel)
        self.gauge = wx.Gauge(self.scenePanel, size=(-1, 30))
        self.gauge.Hide()

        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.sceneView, 1, wx.ALL | wx.EXPAND, 0)
        vbox.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 0)
        self.scenePanel.SetSizer(vbox)

        self.splitterWindow.SplitVertically(self.videoView, self.scenePanel)
        self.splitterWindow.SetMinimumPaneSize(200)

        #-- Layout
        vsbox = wx.BoxSizer(wx.VERTICAL)
        vsbox.Add(self.controls, 0, wx.ALL | wx.EXPAND, 0)
        self.scrollPanel.SetSizer(vsbox)
        vsbox.Fit(self.scrollPanel)

        self.addToPanel(self.scrollPanel, 0)
        self.addToPanel(self.splitterWindow, 1)

        #- Video View Selector
        _choices = []
        choices = profile.getProfileSettingObject('img_type').getType()
        for i in choices:
            _choices.append(_(i))
        self.videoViewsDict = dict(zip(_choices, choices))

        self.buttonShowVideoViews = wx.BitmapButton(
            self.videoView, wx.NewId(),
            wx.Bitmap(resources.getPathForImage("views.png"),
                      wx.BITMAP_TYPE_ANY), (10, 10))
        self.comboVideoViews = wx.ComboBox(
            self.videoView,
            value=_(profile.getProfileSetting('img_type')),
            choices=_choices,
            style=wx.CB_READONLY,
            pos=(60, 10))

        self.buttonShowVideoViews.Hide()
        self.comboVideoViews.Hide()

        self.buttonShowVideoViews.Bind(wx.EVT_BUTTON, self.onShowVideoViews)
        self.comboVideoViews.Bind(wx.EVT_COMBOBOX,
                                  self.onComboBoVideoViewsSelect)

        self.updateCallbacks()
        self.Layout()
Ejemplo n.º 6
0
    def load(self):
        #-- Toolbar Configuration
        self.toolbar.Realize()

        self.scrollPanel = wx.lib.scrolledpanel.ScrolledPanel(self._panel, size=(290,-1))
        self.scrollPanel.SetupScrolling(scroll_x=False, scrollIntoView=False)
        self.scrollPanel.SetAutoLayout(1)

        self.controls = ExpandableControl(self.scrollPanel)

        self.videoView = VideoView(self._panel, self.getFrame, 10)
        self.videoView.SetBackgroundColour(wx.BLACK)

        #-- Add Scroll Panels
        self.controls.addPanel('camera_settings', CameraSettingsPanel(self.controls))
        self.controls.addPanel('pattern_settings', PatternSettingsPanel(self.controls))
        self.controls.addPanel('laser_settings', LaserSettingsPanel(self.controls))
        self.controls.addPanel('camera_intrinsics_panel', CameraIntrinsicsPanel(self.controls, buttonStartCallback=self.onCameraIntrinsicsStartCallback))
        self.controls.addPanel('laser_triangulation_panel', LaserTriangulationPanel(self.controls, buttonStartCallback=self.onLaserTriangulationStartCallback))
        self.controls.addPanel('platform_extrinsics_panel', PlatformExtrinsicsPanel(self.controls, buttonStartCallback=self.onPlatformExtrinsicsStartCallback))

        #-- Add Calibration Pages
        self.cameraIntrinsicsMainPage = CameraIntrinsicsMainPage(self._panel,
                                                                 afterCancelCallback=self.onCancelCallback,
                                                                 afterCalibrationCallback=self.onCameraIntrinsicsAfterCalibrationCallback)

        self.cameraIntrinsicsResultPage = CameraIntrinsicsResultPage(self._panel,
                                                                     buttonRejectCallback=self.onCancelCallback,
                                                                     buttonAcceptCallback=self.onCameraIntrinsicsAcceptCallback)

        self.laserTriangulationMainPage = LaserTriangulationMainPage(self._panel,
                                                                     afterCancelCallback=self.onCancelCallback,
                                                                     afterCalibrationCallback=self.onLaserTriangulationAfterCalibrationCallback)

        self.laserTriangulationResultPage = LaserTriangulationResultPage(self._panel,
                                                                         buttonRejectCallback=self.onCancelCallback,
                                                                         buttonAcceptCallback=self.onLaserTriangulationAcceptCallback)

        self.platformExtrinsicsMainPage = PlatformExtrinsicsMainPage(self._panel,
                                                                     afterCancelCallback=self.onCancelCallback,
                                                                     afterCalibrationCallback=self.onPlatformExtrinsicsAfterCalibrationCallback)

        self.platformExtrinsicsResultPage = PlatformExtrinsicsResultPage(self._panel,
                                                                         buttonRejectCallback=self.onCancelCallback,
                                                                         buttonAcceptCallback=self.onPlatformExtrinsicsAcceptCallback)

        self.cameraIntrinsicsMainPage.Hide()
        self.cameraIntrinsicsResultPage.Hide()
        self.laserTriangulationMainPage.Hide()
        self.laserTriangulationResultPage.Hide()
        self.platformExtrinsicsMainPage.Hide()
        self.platformExtrinsicsResultPage.Hide()

        #-- Layout
        vsbox = wx.BoxSizer(wx.VERTICAL)
        vsbox.Add(self.controls, 0, wx.ALL|wx.EXPAND, 0)
        self.scrollPanel.SetSizer(vsbox)
        vsbox.Fit(self.scrollPanel)

        self.addToPanel(self.scrollPanel, 0)
        self.addToPanel(self.videoView, 1)

        self.addToPanel(self.cameraIntrinsicsMainPage, 1)
        self.addToPanel(self.cameraIntrinsicsResultPage, 1)
        self.addToPanel(self.laserTriangulationMainPage, 1)
        self.addToPanel(self.laserTriangulationResultPage, 1)
        self.addToPanel(self.platformExtrinsicsMainPage, 1)
        self.addToPanel(self.platformExtrinsicsResultPage, 1)

        self.updateCallbacks()
        self.Layout()