Before this question is dismissed as a duplicate, please note:
- Using OpenCV version 3 (not version 2)
- Using Python 3 (not C++)
- Using PyQt 5 (not PyQt4)
Goal: Trying to stream OpenCV webcam video frames in a PyQt5 GUI window
# For testing, I'm simply reading in a single image instead of a video frame
frame = cv2.imread('Koala.jpg',0) # this is a numpy.ndarray object
height, width = frame.shape
my_image = QImage(frame.tostring(), width, height, QImage.Format_RGB888)
# By here, things seem okay. print(mimage) basically says <QImage object at 0x32243>
# my_image.rgbSwapped() # This line crashes program
pixmap = QPixmap.fromImage(mimage) # This line crashes program as well
I'm not sure how to debug this anymore. No error tracebacks are printed to console. Any help is appreciated. Thanks in advance.