imagewriter.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:robotpy-cscore 作者: robotpy 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号