Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bytes_per_line to the constructor of QImage() #1

Open
b-z opened this issue Apr 11, 2019 · 2 comments
Open

Add bytes_per_line to the constructor of QImage() #1

b-z opened this issue Apr 11, 2019 · 2 comments

Comments

@b-z
Copy link

b-z commented Apr 11, 2019

    @staticmethod
    def get_qimage(cvimage):
        print(cvimage.shape)
        height, width, bytes_per_pix = cvimage.shape
        bytes_per_line = width * bytes_per_pix;
        cv2.cvtColor(cvimage, cv2.COLOR_BGR2RGB, cvimage)
        return QImage(cvimage.data, width, height, bytes_per_line, QImage.Format_RGB888)

Otherwise the image will display abnormally.

@zhaoxiaoqian666
Copy link

Traceback (most recent call last):
File "F:/GraphCut-master1/GraphCut-master/NewCutUI.py", line 161, in
newUI = NewCutUI()
File "F:/GraphCut-master1/GraphCut-master/NewCutUI.py", line 12, in init
self.graph_maker = GraphMaker.GraphMaker()
TypeError: init() missing 2 required positional arguments: 'filename' and 'outfilename'

Process finished with exit code 1

@zhaoxiaoqian666
Copy link

上面的问题应该怎么改啊?求教。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants