game_map.py 文件源码

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

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

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

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


问题


面经


文章

微信
公众号

扫码关注公众号