qt直接读取模式
img_path="pic/p"+str(self.psoe_id)+".png"
print(img_path)
image = QPixmap(img_path)#默认底板图片
label_size = self.label_leran.size()
scaled_image = image.scaled(label_size, aspectRatioMode=True)
self.label_leran.setPixmap(scaled_image)
opecv模式
result_frame=self.ShareImages[1]
rgbImage = cv2.cvtColor(result_frame, cv2.COLOR_BGR2RGB)
convertToQtFormat = QtGui.QImage(rgbImage.data, rgbImage.shape[1], rgbImage.shape[0], QImage.Format_RGB888)
#在这里可以对每帧图像进行处理,
qtimg = convertToQtFormat.scaled(501, 375, Qt.KeepAspectRatio)
self.label_result.setPixmap(QPixmap.fromImage(qtimg))#窗口刷新
if __name__ == '__main__':
#---------------------开启一个单独进程,采集+识别--------------------
#共享内存数据
h=480 #图像默认高
w=640 #图像默认宽
img = cv2.imread("detectImg.png", 1)#默认底板图片
img = cv2.resize(img,(w,h),) #大小调整
managerdata=Manager().dict()
sharelock=Manager().Lock()
managerdata[0]=img# 原始图像
managerdata[1]=img# 结果图像
浙公网安备 33010602011771号