def __init__(self,
                 app,
                 view,
                 cameraIntrinsics=None,
                 debug=True,
                 data_directory=None):

        self.app = app
        self.views = dict()
        self.vis = True
        self.debug = debug
        self.views['foreground'] = view
        self.views['background'] = self.createBackgroundView()

        self.threshold = 10

        if cameraIntrinsics is None:
            self.cameraIntrinsics = makeDefaultCameraIntrinsics()
        else:
            self.cameraIntrinsics = cameraIntrinsics

        # set the views to use the camera intrinsics
        for _, view in self.views.iteritems():
            director_utils.setCameraIntrinsics(view,
                                               self.cameraIntrinsics,
                                               lockViewSize=True)

        self.depthScanners = dict()

        self.depthScanners['foreground'] = initDepthScanner(
            self.app,
            self.views['foreground'],
            widgetArea=QtCore.Qt.RightDockWidgetArea)

        self.depthScanners['background'] = initDepthScanner(
            self.app,
            self.views['background'],
            widgetArea=QtCore.Qt.LeftDockWidgetArea)

        # self.changeDetectionPointCloudView = PythonQt.dd.ddQVTKWidgetView()
        # self.changeDetectionPointCloudView.setWindowTitle('Change Detection Pointcloud')
        # dock = self.app.app.addWidgetToDock(self.changeDetectionPointCloudView, QtCore.Qt.BottomDockWidgetArea)
        # dock.setMinimumWidth(300)
        # dock.setMinimumHeight(300)

        # used for visualizing the depth image/mask coming from change detection
        # self.changeDetectionImageVisualizer = imageview.ImageView()
        # self.changeDetectionImageVisualizer.view.setWindowTitle('Depth Image Change')
        # dock = self.app.app.addWidgetToDock(self.changeDetectionImageVisualizer.view, QtCore.Qt.BottomDockWidgetArea)
        #
        # dock.setMinimumWidth(300)
        # dock.setMinimumHeight(300)

        if data_directory is not None:
            self.data_dir = data_directory
            self.loadData()
    def __init__(self,
                 app,
                 view,
                 cameraIntrinsics=None,
                 debug=True,
                 data_directory=None):
        """
        This shouldn't be called directly. Should only be called via the staticmethod from_data_folder

        :param app:
        :type app:
        :param view:
        :type view:
        :param cameraIntrinsics:
        :type cameraIntrinsics:
        :param debug:
        :type debug:
        :param data_directory: The 'processed' subfolder of a top level log folder
        :type data_directory:
        """

        self.app = app
        self.views = dict()
        self.vis = True
        self.debug = debug
        self.views['foreground'] = view
        self.views['background'] = self.createBackgroundView()

        self.threshold = 10

        if cameraIntrinsics is None:
            self.cameraIntrinsics = makeDefaultCameraIntrinsics()
        else:
            self.cameraIntrinsics = cameraIntrinsics

        # set the views to use the camera intrinsics
        for _, view in self.views.iteritems():
            director_utils.setCameraIntrinsics(view,
                                               self.cameraIntrinsics,
                                               lockViewSize=True)

        self.depthScanners = dict()

        self.depthScanners['foreground'] = initDepthScanner(
            self.app,
            self.views['foreground'],
            widgetArea=QtCore.Qt.RightDockWidgetArea)

        self.depthScanners['background'] = initDepthScanner(
            self.app,
            self.views['background'],
            widgetArea=QtCore.Qt.LeftDockWidgetArea)
    def __init__(self, app, view, cameraIntrinsics=None, debug=True,
        data_directory=None):

        self.app = app
        self.views = dict()
        self.vis = True
        self.debug = debug
        self.views['foreground'] = view
        self.views['background'] = self.createBackgroundView()

        self.threshold = 10

        if cameraIntrinsics is None:
            self.cameraIntrinsics = makeDefaultCameraIntrinsics()
        else:
            self.cameraIntrinsics = cameraIntrinsics

        # set the views to use the camera intrinsics
        for _, view in self.views.iteritems():
            director_utils.setCameraIntrinsics(view, self.cameraIntrinsics, lockViewSize=True)

        self.depthScanners = dict()


        self.depthScanners['foreground'] = initDepthScanner(self.app, self.views['foreground'],
                                                            widgetArea=QtCore.Qt.RightDockWidgetArea)

        self.depthScanners['background'] = initDepthScanner(self.app, self.views['background'],
                                                            widgetArea=QtCore.Qt.LeftDockWidgetArea)

        
        # self.changeDetectionPointCloudView = PythonQt.dd.ddQVTKWidgetView()
        # self.changeDetectionPointCloudView.setWindowTitle('Change Detection Pointcloud')
        # dock = self.app.app.addWidgetToDock(self.changeDetectionPointCloudView, QtCore.Qt.BottomDockWidgetArea)
        # dock.setMinimumWidth(300)
        # dock.setMinimumHeight(300)

        # used for visualizing the depth image/mask coming from change detection
        # self.changeDetectionImageVisualizer = imageview.ImageView()
        # self.changeDetectionImageVisualizer.view.setWindowTitle('Depth Image Change')
        # dock = self.app.app.addWidgetToDock(self.changeDetectionImageVisualizer.view, QtCore.Qt.BottomDockWidgetArea)
        #
        # dock.setMinimumWidth(300)
        # dock.setMinimumHeight(300)

        if data_directory is not None:
            self.data_dir = data_directory
            self.loadData()
    def __init__(self, app, view, cameraIntrinsics=None, debug=True,
        data_directory=None):
        """
        This shouldn't be called directly. Should only be called via the staticmethod from_data_folder

        :param app:
        :type app:
        :param view:
        :type view:
        :param cameraIntrinsics:
        :type cameraIntrinsics:
        :param debug:
        :type debug:
        :param data_directory: The 'processed' subfolder of a top level log folder
        :type data_directory:
        """

        self.app = app
        self.views = dict()
        self.vis = True
        self.debug = debug
        self.views['foreground'] = view
        self.views['background'] = self.createBackgroundView()

        self.threshold = 10

        if cameraIntrinsics is None:
            self.cameraIntrinsics = makeDefaultCameraIntrinsics()
        else:
            self.cameraIntrinsics = cameraIntrinsics

        # set the views to use the camera intrinsics
        for _, view in self.views.iteritems():
            director_utils.setCameraIntrinsics(view, self.cameraIntrinsics, lockViewSize=True)

        self.depthScanners = dict()


        self.depthScanners['foreground'] = initDepthScanner(self.app, self.views['foreground'],
                                                            widgetArea=QtCore.Qt.RightDockWidgetArea)

        self.depthScanners['background'] = initDepthScanner(self.app, self.views['background'],
                                                            widgetArea=QtCore.Qt.LeftDockWidgetArea)




        # used for point cloud view
        self.changeDetectionPointCloudView = PythonQt.dd.ddQVTKWidgetView()
        self.changeDetectionPointCloudView.setWindowTitle('Change Detection Pointcloud')
        dock = self.app.app.addWidgetToDock(self.changeDetectionPointCloudView, QtCore.Qt.BottomDockWidgetArea)
        dock.setMinimumWidth(300)
        dock.setMinimumHeight(300)

        # used for visualizing the depth image/mask coming from change detection
        self.changeDetectionImageVisualizer = imageview.ImageView()
        self.changeDetectionImageVisualizer.view.setWindowTitle('Depth Image Change')
        dock = self.app.app.addWidgetToDock(self.changeDetectionImageVisualizer.view, QtCore.Qt.BottomDockWidgetArea)
        
        dock.setMinimumWidth(300)
        dock.setMinimumHeight(300)