Warm tip: This article is reproduced from stackoverflow.com, please click
opencv pyqt python

Display Camera in pyqt

发布于 2020-04-03 23:21:07

Can we display a camera feed in Pyqt? I can only display a simple view through the opencv window in python. I want to add some more options while displaying the pyqt window.

Questioner
Shahir Ansari
Viewed
97
101 2016-12-31 06:26

Yes, you can do it using QLabel and setting the label's QPixmap. Something vaguely along the lines of:

label = QtGui.QLabel()
image = QtGui.QImage(
    frame,
    frame.shape[1],
    frame.shape[0],
    frame.shape[1] * 3,
    QtGui.QImage.Format_RGB888
)
label.setPixmap(QtGui.QPixmap.fromImage(image))

where frame is your camera frame data.