@QtCore.pyqtSlot()
def startVideo(self):
global image
run_video = True
while run_video:
ret, image = self.camera.read()
color_swapped_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
qt_image1 = QtGui.QImage(color_swapped_image.data,
self.width,
self.height,
color_swapped_image.strides[0],
QtGui.QImage.Format_RGB888)
self.VideoSignal1.emit(qt_image1)
if self.flag:
img_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
img_canny = cv2.Canny(img_gray, 50, 100)
qt_image2 = QtGui.QImage(img_canny.data,
self.width,
self.height,
img_canny.strides[0],
QtGui.QImage.Format_Grayscale8)
self.VideoSignal2.emit(qt_image2)
loop = QtCore.QEventLoop()
QtCore.QTimer.singleShot(25, loop.quit) #25 ms
loop.exec_()
How this can be work about loop?
When the loop in while: do the singleshot 25ms until loop.quit,
Then what is the loop.exec??
I can't understand loop and singleshot in this code.