Now I'm doing graph cut project from this repository https://github.com/NathanZabriskie/GraphCut/tree/master And I try to execute the code from folder "graph_cut" file "NewCutUI.py"
import sys
import cv2
import numpy as np
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import GraphMaker
class NewCutUI:
def __init__(self):
self.graph_maker = GraphMaker.GraphMaker()
self.a = QApplication(sys.argv)
self.window = QMainWindow()
self.window.setWindowTitle("GraphCut")
self.seed_num = self.graph_maker.foreground
# Setup file menu
mainMenu = self.window.menuBar()
fileMenu = mainMenu.addMenu('&File')
openButton = QAction(QIcon('exit24.png'), 'Open Image', self.window)
openButton.setShortcut('Ctrl+O')
openButton.setStatusTip('Open a file for segmenting.')
openButton.triggered.connect(self.on_open)
fileMenu.addAction(openButton)
@pyqtSlot()
def on_open(self):
f = QFileDialog.getOpenFileName()
if f is not None:#and f != "":
self.graph_maker.load_image(str(f))
self.seedLabel.setPixmap(QPixmap.fromImage(
self.get_qimage(self.graph_maker.get_image_with_overlay(self.graph_maker.seeds))))
self.segmentLabel.setPixmap(QPixmap.fromImage(
self.get_qimage(self.graph_maker.get_image_with_overlay(self.graph_maker.segmented))))
But when I execute, I got this error:
TypeError: connect() failed between triggered(bool) and on_open()
How can i fixed it? here is repository that I got code from in file "NewCutUI.py" ref: https://github.com/NathanZabriskie/GraphCut/tree/master