0
我有这个代码的网络摄像头,应该显示在窗口(在Qt设计师设计)此代码工作良好,但现在我有两个凸轮窗口,一个在我的主窗口(窗体设计在Qt设计器)和一个主窗口。显示网络摄像头蟒蛇
def b1_clicked(self):
mycam = cv2.VideoCapture(0)
if mycam.isOpened():
_, frame = mycam.read()
else:
_, frame = False
while (True):
cv2.imshow("preview", frame)
_, frame = mycam.read()
frame = cv2.cvtColor(frame, cv2.cv.CV_BGR2RGB)
image = QtGui.QImage(frame, frame.shape[1], frame.shape[0],frame.strides[0], QtGui.QImage.Format_RGB888)
self.label.setPixmap(QtGui.QPixmap.fromImage(image))
key = cv2.waitKey(20)
if key == 27: # escape ESC
break
请任何建议如何杀死,并使其不在主窗口中的窗体。
谢谢