def run(self):
while True:
if self.flag:
ret, image = self.camera.read()
if image is None:
break
color_swapped_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
height, width, _ = color_swapped_image.shape
qt_image = QImage(color_swapped_image.data,
width,
height,
color_swapped_image.strides[0],
QImage.Format_RGB888)
pixmap = QPixmap(qt_image)
pixmap = pixmap.scaled(self.videoLabel.geometry().width(), self.videoLabel.geometry().height())
if self.start_flag and self.support_flag:
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
self.path = "appdata/" + self.cap.guide.dataset_type + "/data/" + self.cap.date_str + "-" + str(
self.cap.guide.gesture_type) + ".avi"
self.out = cv2.VideoWriter(self.path, fourcc, 20.0, (640, 480))
self.support_flag = False
if self.name == "Camera" and self.out is not None:
self.image_siganl.emit(image)
self.videoLabel.setPixmap(pixmap)
if self.name == "Video":
time.sleep(1/self.fps)
else:
pass
评论列表
文章目录