Exemplo n.º 1
0
def newCameraView(imageManager, channelName='OPENNI_FRAME', cameraName='OPENNI_FRAME_LEFT', viewName='OpenNI Frame'):

    view = PythonQt.dd.ddQVTKWidgetView()
    view.orientationMarkerWidget().Off()
    view.backgroundRenderer().SetBackground([0,0,0])
    view.backgroundRenderer().SetBackground2([0,0,0])

    imageManager.queue.addCameraStream(channelName, cameraName, lcmbotcore.images_t.LEFT)
    imageManager.addImage(cameraName)

    cameraView = cameraview.CameraImageView(imageManager, cameraName, viewName=viewName, view=view)
    cameraView.eventFilterEnabled = False
    view.renderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleImage())

    return cameraView
Exemplo n.º 2
0
    def setupImageStreams(self):

        streams = [
            CAPTURE_CHANNEL,
            'VIDEO_PLAYBACK_IMAGE']

        self.imageManager = cameraview.ImageManager()

        for channelName in streams:
            self.imageManager.queue.addCameraStream(channelName)
            self.imageManager.addImage(channelName)

        self.currentStream = streams[0]
        self.cameraView = cameraview.CameraImageView(self.imageManager, self.currentStream, view=self.view)
        self.cameraView.eventFilterEnabled = False
        self.view.renderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleImage())
Exemplo n.º 3
0
    def setupImageStreams(self):

        streams = [CAPTURE_CHANNEL, 'VIDEO_PLAYBACK_IMAGE']

        self.imageManager = cameraview.ImageManager()

        for channelName in streams:
            self.imageManager.queue.addCameraStream(channelName)
            self.imageManager.addImage(channelName)

        self.currentStream = streams[0]
        self.cameraView = cameraview.CameraImageView(self.imageManager,
                                                     self.currentStream,
                                                     view=self.view)
        self.cameraView.eventFilterEnabled = False
        self.view.renderWindow().GetInteractor().SetInteractorStyle(
            vtk.vtkInteractorStyleImage())
Exemplo n.º 4
0
def main():

    app = ConsoleApp()

    view = app.createView(useGrid=False)
    view.orientationMarkerWidget().Off()
    view.backgroundRenderer().SetBackground([0,0,0])
    view.backgroundRenderer().SetBackground2([0,0,0])


    cameraChannel = parseChannelArgument()
    imageManager = cameraview.ImageManager()
    imageManager.queue.addCameraStream(cameraChannel)
    imageManager.addImage(cameraChannel)


    cameraView = cameraview.CameraImageView(imageManager, cameraChannel, view=view)
    cameraView.eventFilterEnabled = False
    view.renderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleImage())


    view.show()
    app.start()
Exemplo n.º 5
0
def main():

    app = ConsoleApp()

    view = app.createView(useGrid=False)
    view.orientationMarkerWidget().Off()
    view.backgroundRenderer().SetBackground([0, 0, 0])
    view.backgroundRenderer().SetBackground2([0, 0, 0])

    cameraChannel = parseChannelArgument()
    imageManager = cameraview.ImageManager()
    imageManager.queue.addCameraStream(cameraChannel)
    imageManager.addImage(cameraChannel)

    cameraView = cameraview.CameraImageView(imageManager,
                                            cameraChannel,
                                            view=view)
    cameraView.eventFilterEnabled = False
    view.renderWindow().GetInteractor().SetInteractorStyle(
        vtk.vtkInteractorStyleImage())

    view.show()
    app.start()
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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