Пример #1
0
#         kmeans = KMeans(C0_8U, num_colors=20)
#         centerImage = kmeans.centerImage()
#         self._view.render(centerImage)
#
#         histImage = kmeans.histImage()
#
#         plt.imshow(histImage)
#         plt.show()

        edgeSeg = EdgeBasedSegmentaiton(C0_8U)
        labels = edgeSeg.labels()
        plt.imshow(labels)
        plt.show()

    def finishCharacter(self):
        if self._character_name != "":
            self._stroke_sets.save(self._segmentationFile())
        self.runCharacter()

    def _segmentationFile(self):
        return self.characterResultFile("segmentation.json")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    view = ImageView()
    view.showMaximized()
    tool = StrokeTool()
    view.setTool(tool)
    batch = SegmentationBatch(view, tool)
    view.setReturnCallback(batch.finishCharacter)
    sys.exit(app.exec_())
        if os.path.exists(self.characterConstraintFile()):
            self._normal_constraint.load(self.characterConstraintFile())
        self._tool.setImage(C0_32F)

    def constraintFile(self):
        return self.resultFile(self._data_name + "_normal_constraint.json")

    def characterConstraintFile(self):
        return self.characterResultFile("normal_constraint.json")

    def finish(self):
        constraint_file = self.resultFile(self._data_name + "_normal_constraint.json")
        self._normal_constraint.save(constraint_file)
        self.runNext()

    def finishCharacter(self):
        if self._character_name != "":
            constraint_file = self.characterResultFile("normal_constraint.json")
            self._normal_constraint.save(constraint_file)
        self.runCharacter()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    view = ImageView()
    view.showMaximized()
    tool = NormalConstraintTool()
    view.setTool(tool)
    batch = NormalConstraintBatch(view, tool)
    view.setReturnCallback(batch.finish)
    sys.exit(app.exec_())
Пример #3
0
        self._tool.setImage(C0_32F)

    def constraintFile(self):
        return self.resultFile(self._data_name + "_normal_constraint.json")

    def characterConstraintFile(self):
        return self.characterResultFile("normal_constraint.json")

    def finish(self):
        constraint_file = self.resultFile(self._data_name +
                                          "_normal_constraint.json")
        self._normal_constraint.save(constraint_file)
        self.runNext()

    def finishCharacter(self):
        if self._character_name != "":
            constraint_file = self.characterResultFile(
                "normal_constraint.json")
            self._normal_constraint.save(constraint_file)
        self.runCharacter()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    view = ImageView()
    view.showMaximized()
    tool = NormalConstraintTool()
    view.setTool(tool)
    batch = NormalConstraintBatch(view, tool)
    view.setReturnCallback(batch.finish)
    sys.exit(app.exec_())