Exemple #1
0
    def onInsertionModeStarted(self, label_class):
        # Abort current inserter
        if self._inserter is not None:
            self._inserter.abort()

        self.deselectAllItems()

        # Add new inserter
        default_properties = self._labeltool.propertyeditor(
        ).currentEditorProperties()
        inserter = self._inserterfactory.create(label_class, self._labeltool,
                                                self, default_properties)
        if inserter is None:
            raise InvalidArgumentException(
                "Could not find inserter for class '%s' with default properties '%s'"
                % (label_class, default_properties))
        inserter.inserterFinished.connect(self.onInserterFinished)
        if self._switch_image_mode:
            inserter.annotationFinished.connect(self.onAnnotationFinished)
        self._labeltool.currentImageChanged.connect(inserter.imageChange)
        self._inserter = inserter
        LOG.debug(
            "Created inserter for class '%s' with default properties '%s'" %
            (label_class, default_properties))
        # Change cursor to cross
        self.views()[0].viewport().setCursor(Qt.CrossCursor)
Exemple #2
0
    def onInsertionModeStarted(self, label_class):
        # Abort current inserter
        if self._inserter is not None:
            self._inserter.abort()

        self.deselectAllItems()

        if not self.inputflag:
            self.inputflag = True
            self.inittime = time.ctime()
            self.timer.start(60000)

        # Add new inserter
        default_properties = self._labeltool.propertyeditor(
        ).currentEditorProperties()
        inserter = self._inserterfactory.create(label_class, self._labeltool,
                                                self, default_properties)
        if inserter is None:
            raise InvalidArgumentException(
                "Could not find inserter for class '%s' with default properties '%s'"
                % (label_class, default_properties))
        if isinstance(inserter, FreehandItemInserter):
            inserter.setColorMap(label_class)
        inserter.inserterFinished.connect(self.onInserterFinished)
        self._labeltool.currentImageChanged.connect(inserter.imageChange)
        self._inserter = inserter
        scale = self._labeltool.mainWindow().view.getScale()
        self._inserter.setScale(scale)
        LOG.debug(
            "Created inserter for class '%s' with default properties '%s'" %
            (label_class, default_properties))
        # Change cursor to cross
        self.views()[0].viewport().setCursor(Qt.CrossCursor)
Exemple #3
0
 def load(self, filename):
     """
     Load the annotations.
     """
     if not filename:
         raise InvalidArgumentException("filename cannot be empty")
     self._filename = filename
     start = time.time()
     ann = self.parseFromFile(filename)
     diff = time.time() - start
     LOG.info("Loaded annotations from %s in %.2fs" % (filename, diff))
     return ann
Exemple #4
0
    def load(self, filename):
        """
        Load the annotations.
        """
        if not filename:
            raise InvalidArgumentException("filename cannot be empty")
        self._filename = filename

        start = time.time()
        ann = self.parseFromFile(filename)
        diff = time.time() - start

        filenameutf = utils.toUTFStr(filename)

        LOG.info(u"Loaded annotations from {} in {:.2f}... ann = {}".format(
            filenameutf, diff, ann))
        return ann
Exemple #5
0
    def onInsertionModeStarted(self, label_class):
        # Abort current inserter
        if self._inserter is not None:
            self._inserter.abort()

        self.deselectAllItems()

        # Add new inserter
        default_properties = self._labeltool.propertyeditor(
        ).currentEditorProperties()
        inserter = self._inserterfactory.create(label_class, self._labeltool,
                                                self, default_properties)
        if inserter is None:
            raise InvalidArgumentException(
                "Could not find inserter for class '%s' with default properties '%s'"
                % (label_class, default_properties))
        inserter.inserterFinished.connect(self.onInserterFinished)
        self._labeltool.currentImageChanged.connect(inserter.imageChange)
        self._inserter = inserter
        LOG.debug(
            "Created inserter for class '%s' with default properties '%s'" %
            (label_class, default_properties))
        #Abhishek Start: Setting cross cursor for SceneView (image view)
        self._labeltool._mainwindow.view.setCursor((QCursor(Qt.CrossCursor)))