game_map.py 文件源码

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

项目:ms-pacman 作者: anassinator 项目源码 文件源码
def to_image(self):
        """Converts map to a viewable image.

        Returns:
            OpenCV image.
        """
        height, width = self._map.shape
        image = np.zeros((height, width, 3), dtype=np.uint8)
        for i in range(width):
            for j in range(height):
                classification = self._map[j, i]
                image[j, i] = GameMapObjects.to_color(classification)

        upscaled_image = cv2.resize(image, (100, 100),
                                    interpolation=cv2.INTER_NEAREST)
        return upscaled_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号