def create_change_detection_app(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', False) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(False) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Depth Scanner') app.mainWindow.show() app.mainWindow.resize(920, 600) app.mainWindow.move(0, 0) view = app.view view.setParent(None) mdiArea = QtGui.QMdiArea() app.mainWindow.setCentralWidget(mdiArea) subWindow = mdiArea.addSubWindow(view) subWindow.setMinimumSize(300, 300) subWindow.setWindowTitle('Camera image') subWindow.resize(640, 480) mdiArea.tileSubWindows() globalsDict['view'] = view globalsDict['app'] = app
def create_change_detection_app(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', False) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(False) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Depth Scanner') app.mainWindow.show() app.mainWindow.resize(920, 600) app.mainWindow.move(0, 0) view = app.view view.setParent(None) mdiArea = QtGui.QMdiArea() app.mainWindow.setCentralWidget(mdiArea) subWindow = mdiArea.addSubWindow(view) subWindow.setMinimumSize(300, 300) subWindow.setWindowTitle('Camera image') subWindow.resize(640, 480) mdiArea.tileSubWindows() globalsDict['view'] = view globalsDict['app'] = app
def main(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', False) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(False) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Depth Scanner') app.mainWindow.show() app.mainWindow.resize(920, 600) app.mainWindow.move(0, 0) view = app.view view.setParent(None) mdiArea = QtGui.QMdiArea() app.mainWindow.setCentralWidget(mdiArea) subWindow = mdiArea.addSubWindow(view) subWindow.setMinimumSize(300, 300) subWindow.setWindowTitle('Camera image') subWindow.resize(640, 480) mdiArea.tileSubWindows() #affordanceManager = affordancemanager.AffordanceObjectModelManager(view) depthScanner = DepthScanner(view) depthScanner.update() dock = app.app.addWidgetToDock(depthScanner.imageView.view, QtCore.Qt.RightDockWidgetArea) dock.setMinimumWidth(300) dock.setMinimumHeight(300) dock = app.app.addWidgetToDock(depthScanner.pointCloudView, QtCore.Qt.RightDockWidgetArea) dock.setMinimumWidth(300) dock.setMinimumHeight(300) # add some test data def addTestData(): d = DebugData() # d.addSphere((0,0,0), radius=0.5) d.addArrow((0, 0, 0), (0, 0, 1), color=[1, 0, 0]) d.addArrow((0, 0, 1), (0, .5, 1), color=[0, 1, 0]) vis.showPolyData(d.getPolyData(), 'debug data', colorByName='RGB255') view.resetCamera() addTestData() # xvfb command # /usr/bin/Xvfb :99 -ac -screen 0 1280x1024x16 if globalsDict is not None: globalsDict.update(dict(app=app, view=view, depthScanner=depthScanner)) app.app.start(restoreWindow=False)
def main(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', False) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(False) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Depth Scanner') app.mainWindow.show() app.mainWindow.resize(920,600) app.mainWindow.move(0,0) view = app.view view.setParent(None) mdiArea = QtGui.QMdiArea() app.mainWindow.setCentralWidget(mdiArea) subWindow = mdiArea.addSubWindow(view) subWindow.setMinimumSize(300,300) subWindow.setWindowTitle('Camera image') subWindow.resize(640, 480) mdiArea.tileSubWindows() #affordanceManager = affordancemanager.AffordanceObjectModelManager(view) depthScanner = DepthScanner(view) depthScanner.update() dock = app.app.addWidgetToDock(depthScanner.imageView.view, QtCore.Qt.RightDockWidgetArea) dock.setMinimumWidth(300) dock.setMinimumHeight(300) dock = app.app.addWidgetToDock(depthScanner.pointCloudView, QtCore.Qt.RightDockWidgetArea) dock.setMinimumWidth(300) dock.setMinimumHeight(300) # add some test data def addTestData(): d = DebugData() # d.addSphere((0,0,0), radius=0.5) d.addArrow((0,0,0), (0,0,1), color=[1,0,0]) d.addArrow((0,0,1), (0,.5,1), color=[0,1,0]) vis.showPolyData(d.getPolyData(), 'debug data', colorByName='RGB255') view.resetCamera() addTestData() # xvfb command # /usr/bin/Xvfb :99 -ac -screen 0 1280x1024x16 if globalsDict is not None: globalsDict.update(dict(app=app, view=view, depthScanner=depthScanner)) app.app.start(restoreWindow=False)
def createApp(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', True) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(True) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Mesh Processing') app.mainWindow.show() app.mainWindow.resize(920, 600) app.mainWindow.move(0, 0) view = app.view globalsDict['view'] = view globalsDict['app'] = app
def createApp(globalsDict=None): from director import mainwindowapp from PythonQt import QtCore, QtGui app = mainwindowapp.construct() app.gridObj.setProperty('Visible', True) app.viewOptions.setProperty('Orientation widget', True) app.viewOptions.setProperty('View angle', 30) app.sceneBrowserDock.setVisible(False) app.propertiesDock.setVisible(False) app.mainWindow.setWindowTitle('Depth Scanner') app.mainWindow.show() app.mainWindow.resize(920,600) app.mainWindow.move(0,0) view = app.view globalsDict['view'] = view globalsDict['app'] = app
"images/0000000001_labels.png")): print "" print "Already made labels? Skipping..." print "To re-extract, either move or delete ./images/" print "" quit() parser = drcargs.getGlobalArgParser().getParser() parser.add_argument( '--logFolder', type=str, dest='logFolder', help= 'location of top level folder for this log, relative to CorlDev/data') parser.add_argument('-debugCorl', action='store_true') args = parser.parse_args() app = mainwindowapp.construct(disable_anti_alias=True) app.view.setParent(None) app.view.show() print "logFolder = ", args.logFolder pathDict = corl.utils.getFilenames(args.logFolder) rti = RenderTrainingImages(app.view, app.viewOptions, pathDict) if args.debugCorl: globals().update(rti=rti) app.app.start() else: rti.renderAndSaveLabeledImages()
def getArgs(): parser = argparse.ArgumentParser() parser.add_argument('--urdf', type=str, default=None, help='urdf filename to load') parser.add_argument( '--glob-dir', type=str, default=None, help='recursively search this directory and load every urdf found') args, unknown = parser.parse_known_args() return args app = mainwindowapp.construct() view = app.view args = getArgs() if args.urdf: robotModel, jointController = roboturdf.loadRobotModel(urdfFile=args.urdf, view=view, useConfigFile=False) jointNames = robotModel.model.getJointNames() jointController = jointcontrol.JointController([robotModel], jointNames=jointNames) elif args.glob_dir:
def setupToolbar(): toolBar = applogic.findToolBar('Main Toolbar') app.app.addToolBarAction(toolBar, 'Gripper Open', icon='', callback=gripperOpen) app.app.addToolBarAction(toolBar, 'Gripper Close', icon='', callback=gripperClose) # create a default mainwindow app app = mainwindowapp.construct(globalsDict=globals()) # load a minimal robot system with ik planning robotSystem = robotsystem.create(app.view, planningOnly=True) # add the teleop and playback panels to the mainwindow app.app.addWidgetToDock(robotSystem.teleopPanel.widget, QtCore.Qt.RightDockWidgetArea) app.app.addWidgetToDock(robotSystem.playbackPanel.widget, QtCore.Qt.BottomDockWidgetArea) setupToolbar() # show sim time in the status bar infoLabel = KukaSimInfoLabel(app.mainWindow.statusBar())
view.renderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleImage()) return cameraView if __name__ == '__main__': # parse args first parser = drcargs.getGlobalArgParser().getParser() parser.add_argument('--logFolder', type=str, dest='logFolder', help='location of top level folder for this log, relative to CorlDev/data') args = parser.parse_args() print 'log folder:', args.logFolder # construct the app fields = mainwindowapp.construct() imageManager = initImageManager() openniDepthPointCloud = initDepthPointCloud(imageManager, fields.view) cameraView = newCameraView(imageManager) affordanceManager = affordancemanager.AffordanceObjectModelManager(fields.view) myObjects = dict() myObjects['imageManager'] = imageManager myObjects['openniDepthPointCloud'] = openniDepthPointCloud myObjects['cameraView'] = cameraView myObjects['affordanceManager'] = affordanceManager myObjects['CorlUtils'] = corl.utils # these lines are used to update the globals for the interactive python console fields.globalsDict.update(**dict(fields))
def gripperClose(): sendGripperCommand(15, 40) def setupToolbar(): toolBar = applogic.findToolBar('Main Toolbar') app.app.addToolBarAction( toolBar, 'Gripper Open', icon='', callback=gripperOpen) app.app.addToolBarAction( toolBar, 'Gripper Close', icon='', callback=gripperClose) # create a default mainwindow app app = mainwindowapp.construct() # load a minimal robot system with ik planning robotSystem = robotsystem.create(app.view, planningOnly=True) # add the teleop and playback panels to the mainwindow app.app.addWidgetToDock(robotSystem.teleopPanel.widget, QtCore.Qt.RightDockWidgetArea) app.app.addWidgetToDock(robotSystem.playbackPanel.widget, QtCore.Qt.BottomDockWidgetArea) setupToolbar() # show sim time in the status bar infoLabel = KukaSimInfoLabel(app.mainWindow.statusBar())
def writeMultiBlockPolyData(polyDataList, outFile): mb = vtk.vtkMultiBlockDataSet() mb.SetNumberOfBlocks(len(polyDataList)) for i, polyData in enumerate(polyDataList): mb.SetBlock(i, polyData) writer = vtk.vtkXMLMultiBlockDataWriter() writer.SetFileName(outFile) writer.SetInput(mb) writer.Write() if __name__ == '__main__': if len(sys.argv) < 2: print 'Usage: %s <mesh file>' % sys.argv[0] sys.exit(1) scene = loadAssimpSceneFromFile(sys.argv[1]) from director import mainwindowapp app = mainwindowapp.construct(globals()) scene.addToView(app.view) app.app.start()
normal = np.array(pickPointFields.pickedNormal) image[i, j, :] = normal # add some rgb conversion step, maybe png writer does that??? return image if __name__ == '__main__': #setup view_height = 640 view_width = 480 data_dir = sys.argv[1] num_im = int(sys.argv[2]) mesh = sys.argv[3] #launch app application = mainwindowapp.construct() #globals? view = app.getCurrentRenderView() #app.resetCamera(viewDirection=[-1,0,0], view=view) #load mesh TODO: load raw point cloud and convert to mesh automatically polyData = ioUtils.readPolyData(data_dir + '/' + sys.argv[3]) obj = vis.showPolyData(polyData, name=mesh) #setup view.setFixedSize(view_height, view_width) setCameraInstrinsicsAsus(view) setCameraTransform(view.camera(), vtk.vtkTransform()) view.forceRender() filter1 = vtk.vtkWindowToImageFilter() filter1 = vtk.vtkWindowToImageFilter()