frame_processing.py 文件源码

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

项目:SerpentAI 作者: SerpentAI 项目源码 文件源码
def process_frame_for_game_play(frame):
    """Assumes a grayscale frame"""
    histogram = skimage.exposure.histogram(frame[40:])

    if np.unique(histogram[0]).size < 3:
        return None

    max_indices = np.argpartition(histogram[0], -3)[-3:]

    for index in sorted(max_indices)[:2]:
        frame[frame == index] = 0

    threshold = skimage.filters.threshold_otsu(frame[40:])
    bw_frame = frame > threshold

    return bw_frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号