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
评论列表
文章目录