小白踩pyqt5的坑:
1.二值图(或者灰度图)转QImage对象
height, width, dim = frame.shape
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)#转成RGB
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)#转成灰度图
h1,frame=cv2.threshold(frame,127,255,cv2.THRESH_BINARY)#转成二值图
image = QImage(frame.data, width, height,width*1,QImage.Format_Grayscale8)#二值图转成Qimage对象
小白pyqt5入门记
最新推荐文章于 2023-05-07 21:03:55 发布