AnalizeFrame.py 文件源码

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

项目:serbian-alpr 作者: golubaca 项目源码 文件源码
def foreground(self, image, smooth=False, grayscale=False):
        """
        Extract foreground from background
        :param image:
        :param smooth:
        :param grayscale:
        :return:
        """
        if smooth and grayscale:
            image = self.toGrayscale(image)
            image = self.smooth(image)
        elif smooth:
            image = self.smooth(image)
        elif grayscale:
            image = self.toGrayscale(image)
        fgmask = self.fgbg.apply(image)
        ret, mask = cv2.threshold(fgmask, 200, 255, cv2.THRESH_BINARY_INV)
        mask_inv = cv2.bitwise_not(mask)
        return mask_inv
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号