Ask Your Question

Revision history [back]

If anyone having the same issue, please import qimage2ndarray this library and add the following changes to the function display_video_stream

def display_video_stream(self):
"""Read frame from camera and repaint QLabel widget.
"""

_, frame = self.capture.read()

frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# frame = cv2.flip(frame, 1)
image = qimage2ndarray.array2qimage(frame) #Solution for memory leak
self.image_label.setPixmap(QPixmap.fromImage(image))