def __init__(self, dataset_browser=None):
        super(MainWindow, self).__init__()
        self.setAcceptDrops(True)
        self._scene = Scene()
        self._image_view = ImageView()
        self._depth_view = ModelView()

        self._createCentralWidget([('Image View', self._image_view),
                                   ('Depth View', self._depth_view)])

        self._status_bar = QStatusBar(self)
        self.setStatusBar(self._status_bar)
        self.showMaximized()

        self._createMenus()

        self._scene.updatedImage.connect(self._image_view.render)
        self._scene.updatedDepth.connect(self._depth_view.setRGBAD)
        self._scene.updatedMessage.connect(self._status_bar.showMessage)
        self.setFocusPolicy(Qt.StrongFocus)
        self.setWindowTitle("Image Viewer")
            saveNormal(self.characterResultFile("N_b_smooth.png"), self._N_b_smooth, A_8U)
            saveNormal(self.characterResultFile("N_d.png"), self._N_d, A_8U)
            saveNormal(self.characterResultFile("N_d_smooth.png"), self._N_d_smooth, A_8U)
            saveNormal(self.characterResultFile("N_lumo.png"), self._N_lumo, A_8U)
            saveNormal(self.characterResultFile("N0_b.png"), self._N0_b_32F, A_8U)
            saveNormal(self.characterResultFile("N0_d.png"), self._N0_d_32F, A_8U)

    def finishCharacter(self):
        if self._character_name != "":
            pass

        self.runCharacter()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    view = ImageView()
    view.showMaximized()
    editor = ParameterEditor()
    editor.addFloatParameter("sigmaSpace", min_val=1.0, max_val=30.0, default_val=5.0)
    editor.addFloatParameter("sigmaRange", min_val=0.0, max_val=1.0, default_val=0.3)
    editor.addFloatParameter("bumpScale", min_val=10.0, max_val=50.0, default_val=20.0)

    batch = BaseDetailSeprationBatch(editor.parameters(), view)
    editor.addButton("Compute Silhouette Normal", cmd_func=batch.computeInitialNormal)
    editor.addButton("Compute Detail Normal", cmd_func=batch.computeDetailNormal)

    editor.show()

    #view.setReturnCallback(batch.finishCharacter)
    batch.runCharacters()
    sys.exit(app.exec_())
Example #3
0
            saveNormal(self.characterResultFile("N_lumo.png"), self._N_lumo,
                       A_8U)
            saveNormal(self.characterResultFile("N0_b.png"), self._N0_b_32F,
                       A_8U)
            saveNormal(self.characterResultFile("N0_d.png"), self._N0_d_32F,
                       A_8U)

    def finishCharacter(self):
        if self._character_name != "":
            pass

        self.runCharacter()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    view = ImageView()
    view.showMaximized()
    editor = ParameterEditor()
    editor.addFloatParameter("sigmaSpace",
                             min_val=1.0,
                             max_val=30.0,
                             default_val=5.0)
    editor.addFloatParameter("sigmaRange",
                             min_val=0.0,
                             max_val=1.0,
                             default_val=0.3)
    editor.addFloatParameter("bumpScale",
                             min_val=10.0,
                             max_val=50.0,
                             default_val=20.0)
        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_())
#         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_())