如何将交互式opencv窗口集成到pyqt5小部件

时间:2019-05-17 13:02:02

标签: python opencv pyqt5

我想在pyqt5窗口中使用opencv(cv2)在图像内绘制蒙版。我尝试使用Qwidget和QFrame,但无法链接这两个软件包。

import sys, os
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWidgets import QMainWindow,QLabel,  QMessageBox, 
QTableWidgetItem, QWidget, QApplication, QAction
import cv2

import Draw_ui

class DRWindow(QMainWindow, Draw_ui.Ui_Draw):
    def __init__(self):
        QMainWindow.__init__(self)
        self.setupUi(self)

        image = cv2.imread('mypic.png', cv2.IMREAD_UNCHANGED)

        cv2.namedWindow('Draw here', cv2.WINDOW_AUTOSIZE)
        cv2.setMouseCallback('Draw here', roi1)

    ????????


    #self.graphicsView()

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    mainWin = DRWindow()
    mainWin.show()
    sys.exit( app.exec_() )

0 个答案:

没有答案