in orrb/utils.py [0:0]
def write(self, image, timeout=0):
""" Returns True if user pressed escape. """
if isinstance(image, list):
image = np.vstack(np.flipud(image))
elif isinstance(image, dict):
images = []
for key, img in image.items():
if (isinstance(img, np.ndarray) and
img.ndim in (3, 4) and
img.shape[-1] in (1, 3) and
img.dtype == np.uint8):
images.append(np.flipud(img))
assert all((images[0].shape == img.shape) for img in images)
image = np.vstack(images)
if self.print_numbers:
self.cv2.putText(image, f'{self.count}', (10, 20), self.cv2.FONT_HERSHEY_DUPLEX, 0.5,
(224, 224, 224))
self.count += 1
self.history.append(image)
if len(self.history) > self.history_size:
self.history.pop(0)
image = np.hstack(self.history)
self.cv2.imshow(self.window_name, self.cv2.cvtColor(image, self.cv2.COLOR_BGR2RGB))
res = self.cv2.waitKey(timeout)
return (res == 27)