def __init__(self, scene, view, parent=None): super(ColorMapCommand, self).__init__(scene, "ColrMap", parent) self._view = view self._tool = StrokeTool() self._tool.setStrokeEditedCallBack(self._strokeEdited) self._matplot_view = MatplotFrame() self._matplot_view.show() self._cmap_id = 0 self._newColorMapID() print self._cmap_id print self._currentColorMapFile()
def __init__(self, scene, view, parent=None): super(StrokeToolCommand, self).__init__(scene, "&Stroke Tool", parent) self._view = view self._tool = StrokeTool() action = self.action() action.setShortcut("S")
def __init__(self, scene, view, parent=None): super(GraphCutCommand, self).__init__(scene, "GraphCut", parent) self._view = view self._tool = StrokeTool() self._tool.setStrokeEditedCallBack(self._strokeEdited)
# 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_())