Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT Python Development



  • Hello all I used Anaconda and Spyder to install Python 3.7 with QTDesigner Interface.

    I have the following code.

        cap = cv2.VideoCapture(0)
        ret, frame = cap.read()
        rgbImage = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        qimage = QtGui.QImage(rgbImage.data, rgbImage.shape[1], rgbImage.QtGui.QImage.Format_RGB888)
    

    However, I get the "AttributeError: 'numpy.ndarray' object has no attribute 'QtGui'" when I try to run the program. Am I doing something wrong here?


  • Qt Champions 2019

    @Stevendragoes said in QT Python Development:

    qimage = QtGui.QImage(rgbImage.data, rgbImage.shape[1], rgbImage.QtGui.QImage.Format_RGB888)

    Shouldn't it be

    qimage = QtGui.QImage(rgbImage.data, rgbImage.shape[1], QtGui.QImage.Format_RGB888)
    

    ?


Log in to reply