def decorate_img_for_env(img, env_id, image_scale):
"""
Args:
img (numpy array of (width, height, 3)): input image
env_id (str): the gym env id
image_scale (float): a scale to resize the image
Returns:
an image
Summary:
Adds environment specific image decorations. Currently used to make it easier to
block/label in Pong.
"""
if env_id is not None and 'Pong' in env_id:
h, w, _ = img.shape
est_catastrophe_y = h - 142
est_block_clearance_y = est_catastrophe_y - int(20 * image_scale)
# cv2.line(img, (0, est_catastrophe_y), (int(500 * image_scale), est_catastrophe_y), (0, 0, 255))
cv2.line(img, (250, est_catastrophe_y), (int(500 * image_scale), est_catastrophe_y), (0, 255, 255))
# cv2.line(img, (0, est_block_clearance_y), (int(500 * image_scale), est_block_clearance_y),
# (255, 0, 0))
return img
评论列表
文章目录