def initDepthPointCloud(imageManager, view): openniDepthPointCloud = segmentation.DisparityPointCloudItem('openni point cloud', 'OPENNI_FRAME', 'OPENNI_FRAME_LEFT', imageManager) openniDepthPointCloud.addToView(view) om.addToObjectModel(openniDepthPointCloud, parentObj=om.findObjectByName('sensors')) openniDepthPointCloud.setProperty('Visible', True) openniDepthPointCloud.setProperty('Target FPS', 30) return openniDepthPointCloud
atlasdriver.systemStatus.outputConsole = app.getOutputConsole() atlasdriverpanel.init(atlasDriver) if usePerception: segmentationpanel.init() cameraview.init() colorize.init() cameraview.cameraView.initImageRotations(robotStateModel) cameraview.cameraView.rayCallback = segmentation.extractPointsAlongClickRay multisensepanel.init(perception.multisenseDriver) sensordatarequestpanel.init() # for kintinuous, use 'CAMERA_FUSED', 'CAMERA_TSDF' disparityPointCloud = segmentation.DisparityPointCloudItem( 'stereo point cloud', 'CAMERA', 'CAMERA_LEFT', cameraview.imageManager) disparityPointCloud.addToView(view) om.addToObjectModel(disparityPointCloud, parentObj=om.findObjectByName('sensors')) def createPointerTracker(): return trackers.PointerTracker(robotStateModel, disparityPointCloud) if useGrid: grid = vis.showGrid(view, color=[0, 0, 0], alpha=0.1) grid.setProperty('Surface Mode', 'Surface with edges') app.setBackgroundColor([0.3, 0.3, 0.35], [0.95, 0.95, 1]) viewOptions = vis.ViewOptionsItem(view)
segmentationpanel.init() cameraview.init() colorize.init() cameraview.cameraView.initImageRotations(robotStateModel) cameraview.cameraView.rayCallback = segmentation.extractPointsAlongClickRay if useMultisense: multisensepanel.init(perception.multisenseDriver) else: app.removeToolbarMacro('ActionMultisensePanel') sensordatarequestpanel.init() # for kintinuous, use 'CAMERA_FUSED', 'CAMERA_TSDF' disparityPointCloud = segmentation.DisparityPointCloudItem( 'stereo point cloud', 'CAMERA', 'CAMERA_LEFT', cameraview.imageManager) disparityPointCloud.addToView(view) om.addToObjectModel(disparityPointCloud, parentObj=om.findObjectByName('sensors')) def createPointerTracker(): return trackers.PointerTracker(robotStateModel, disparityPointCloud) if useOpenniDepthImage: openniDepthPointCloud = segmentation.DisparityPointCloudItem( 'openni point cloud', 'OPENNI_FRAME', 'OPENNI_FRAME_LEFT', cameraview.imageManager) openniDepthPointCloud.addToView(view) om.addToObjectModel(openniDepthPointCloud, parentObj=om.findObjectByName('sensors'))
def setup(self): args = self.parseArgs() imageManager = cameraview.ImageManager() self.imageManager = imageManager channel = args.channel imageType = args.imageType self.app = consoleapp.ConsoleApp() self.views = [] if imageType == 'rgb': imageName = channel imageManager.queue.addCameraStream(channel, imageName, -1) imageManager.addImage(imageName) cameraView = cameraview.CameraImageView( imageManager, imageName, view=PythonQt.dd.ddQVTKWidgetView()) cameraView.eventFilterEnabled = False cameraView.view.renderWindow().GetInteractor().SetInteractorStyle( vtk.vtkInteractorStyleImage()) cameraView.view.resize(640, 480) self.views.append(cameraView.view) self.cameraView = cameraView elif imageType == 'rgbd': imageName = channel + '_LEFT' imageManager.queue.addCameraStream(channel, imageName, 0) imageManager.addImage(imageName) cameraView = cameraview.CameraImageView( imageManager, imageName, view=PythonQt.dd.ddQVTKWidgetView()) cameraView.eventFilterEnabled = False cameraView.view.renderWindow().GetInteractor().SetInteractorStyle( vtk.vtkInteractorStyleImage()) self.views.append(cameraView.view) imageName2 = channel + '_D' if args.disparity: imageManager.queue.addCameraStream( channel, imageName2, lcmbotcore.images_t.DISPARITY_ZIPPED) else: imageManager.queue.addCameraStream( channel, imageName2, lcmbotcore.images_t.DEPTH_MM_ZIPPED) imageManager.addImage(imageName2) cameraView2 = cameraview.CameraImageView( imageManager, imageName2, view=PythonQt.dd.ddQVTKWidgetView()) cameraView2.eventFilterEnabled = False cameraView2.useImageColorMap = True cameraView2.view.renderWindow().GetInteractor().SetInteractorStyle( vtk.vtkInteractorStyleImage()) self.views.append(cameraView2.view) if args.pointcloud: from director import segmentation cameraview.imageManager = imageManager pointCloudObj = segmentation.DisparityPointCloudItem( 'Point cloud', channel, imageName, imageManager) view = PythonQt.dd.ddQVTKWidgetView() pointCloudObj.addToView(view) om.addToObjectModel(pointCloudObj) pointCloudObj.setProperty('Visible', True) pointCloudObj.setProperty('Target FPS', 30) pointCloudObj.setProperty('Max Range', 30) pointCloudObj.setProperty('Remove Size', 0) viewBehaviors = viewbehaviors.ViewBehaviors(view) view.camera().SetPosition([0, 0, 0]) view.camera().SetFocalPoint([0, 0, 1]) view.camera().SetViewUp([0, -1, 0]) view.camera().SetViewAngle(45) self.views.append(view) self.cameraView = cameraView self.cameraView2 = cameraView2 w = QtGui.QWidget() l = QtGui.QHBoxLayout(w) for view in self.views: l.addWidget(view) l.setContentsMargins(0, 0, 0, 0) w.resize(640 * len(self.views), 480) w.show() self.addShortcuts(w) self.widget = w