def setImage(self, img):
'''
Call this function when you wish to write the image to disk. Not
every image is written to disk. Makes a copy of the image.
:param img: A numpy array representing an OpenCV image
'''
if not self.active:
return
if self.size is None or self.size[0] != img.shape[0] or self.size[1] != img.shape[1]:
h, w = img.shape[:2]
self.size = (h, w)
self.out1 = np.empty((h, w, 3), dtype=np.uint8)
self.out2 = np.empty((h, w, 3), dtype=np.uint8)
with self.lock:
cv2.copyMakeBorder(img, 0, 0, 0, 0, cv2.BORDER_CONSTANT, value=(0,0,255), dst=self.out1)
self.has_image = True
self.lock.notify()
评论列表
文章目录