Esempio n. 1
0
    def createHoughLinesPLayer(self):
        layerContent = Layers([])
        layerContent.name = 'HoughLinesP'
        layerContent.children = []
        tempChildren = Layers([])
        layerContent.enable = 1

        tempChildren.name = 'rho'
        tempChildren.value = 0.8
        tempChildren.note = 'Distance resolution'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'theta'
        tempChildren.value = 0.01
        tempChildren.note = 'Angle resolution'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'threshold'
        tempChildren.value = 100
        tempChildren.note = 'Accumulator threshold parameter'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'minLineLength'
        tempChildren.value = 10
        tempChildren.note = 'Minimum line length'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'maxLineGap'
        tempChildren.value = 500
        tempChildren.note = 'Maximum allowed gap'
        layerContent.children.append(deepcopy(tempChildren))

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 2
0
    def createHoughLinesLayer(self):
        layerContent = Layers([])
        layerContent.name = 'HoughLines'
        layerContent.children = []
        layerContent.enable = 1

        tempChildren = Layers([])
        tempChildren.name = 'rho'
        tempChildren.value = 0.8
        tempChildren.note = 'Distance resolution'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'theta'
        tempChildren.value = 0.01
        tempChildren.note = 'Angle resolution'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'threshold'
        tempChildren.value = 100
        tempChildren.note = 'Accumulator threshold parameter'
        layerContent.children.append(tempChildren)

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 3
0
    def createGaussianBlurLayer(self):
        layerContent = Layers([])
        layerContent.name = 'GaussianBlur'
        layerContent.children = []
        layerContent.enable = 1

        tempChildren = Layers([])
        tempChildren.name = 'width'
        tempChildren.value = 3
        tempChildren.note = 'ksize.width'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'height'
        tempChildren.value = 3
        tempChildren.note = 'ksize.height'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'sigmaX'
        tempChildren.value = 0
        tempChildren.note = 'sigmaX'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'sigmaY'
        tempChildren.value = 0
        tempChildren.note = 'sigmaY'
        layerContent.children.append(tempChildren)

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 4
0
    def createcvtColorLayer(self):
        layerContent = Layers([])
        layerContent.name = 'cvtColor'
        layerContent.children = []
        layerContent.enable = 1

        tempChildren = Layers([])
        tempChildren.name = 'low'
        tempChildren.value = 50
        tempChildren.note = 'threshold1'
        layerContent.children.append(tempChildren)

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 5
0
    def createfindContoursLayer(self):
        layerContent = Layers([])
        layerContent.name = 'findContours'
        layerContent.children = []
        layerContent.enable = 1

        tempChildren = Layers([])
        tempChildren.name = 'RM'
        tempChildren.value = cv2.RETR_TREE
        tempChildren.note = 'RetrievalModes'
        layerContent.children.append(tempChildren)

        tempChildren = Layers([])
        tempChildren.name = 'CAM'
        tempChildren.value = cv2.CHAIN_APPROX_SIMPLE
        tempChildren.note = 'ContourApproximationModes'
        layerContent.children.append(tempChildren)

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 6
0
    def createHoughCirclesLayer(self):
        layerContent = Layers([])
        layerContent.name = 'HoughCircles'
        layerContent.children = []
        tempChildren = Layers([])

        tempChildren.name = 'dp'
        tempChildren.value = 1.5
        tempChildren.note = 'Inverse ratio'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'minDist'
        tempChildren.value = 100
        tempChildren.note = 'Minimum distance between two circles'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'param1'
        tempChildren.value = 100
        tempChildren.note = 'do not change'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'param2'
        tempChildren.value = 30
        tempChildren.note = 'do not change'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'minRadius'
        tempChildren.value = 10
        tempChildren.note = 'Minimum circle radius'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'maxRadius'
        tempChildren.value = 0
        tempChildren.note = 'Maximum circle radius'
        layerContent.children.append(deepcopy(tempChildren))

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)
Esempio n. 7
0
    def load(self, content, compleet=True):
        match = re.match(
            Project.header.replace('+', '\+') % r'(\d+\.\d+)', content)
        if not match:
            raise Exception('Incorrect project file')
        version = float(match.groups()[0])
        if version not in Project.supported_versions:
            raise VersionMismatchError(match.group(), Project.version)

        execute(self, content)

        if compleet:
            self.parent.filename = self.file

            self.parent.connectToolbarToConfig(True)
            if not self.parent.load(False):
                self.parent.unsetCursor()
                return

        layers = []
        layer = Layers([])
        for parent_layer in self.layers:
            layer.name = parent_layer['name']
            layer.enable = parent_layer['enable']
            layer.children = []

            tempLayer = Layers([])
            for shape in parent_layer['shapes']:
                tempLayer.clear()
                tempLayer.name = shape['name']
                tempLayer.value = shape['value']
                tempLayer.note = shape['note']
                layer.children.append(deepcopy(tempLayer))

            layers.append(deepcopy(layer))

        self.parent.layerContents = Layers(layers)  # overwrite original
        self.parent.load()
Esempio n. 8
0
    def createthresholdLayer(self):
        layerContent = Layers([])
        layerContent.name = 'threshold'
        layerContent.children = []
        tempChildren = Layers([])
        layerContent.enable = 1

        tempChildren.name = 'thresh'
        tempChildren.value = 0
        tempChildren.note = 'thresh'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'maxval'
        tempChildren.value = 255
        tempChildren.note = 'maxval'
        layerContent.children.append(deepcopy(tempChildren))

        tempChildren.name = 'triangle'
        tempChildren.value = 0
        tempChildren.note = '0=otsu,1=triangle'
        layerContent.children.append(deepcopy(tempChildren))

        self.layerContents.append(layerContent)
        self.TreeHandler.buildEntitiesTree(self.layerContents)