pyqt Qlabel显示opencv 自适应大小


这句加上,否则不能自适应大小


ui.label.setScaledContents(True

)  



cv_img_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
height, width, channel = cv_img_rgb.shape
bytesPerLine = channel * width

q_image = QImage(cv_img_rgb[:], cv_img_rgb.shape[1], cv_img_rgb.shape[0], cv_img_rgb.shape[1] * 3,
                           QImage.Format_RGB888)



你可能感兴趣的:(pyqt)