Source code for pytorchrl.envs.atari.utils
import cv2
import numpy as np
[docs]def imdownscale(state, target_shape=(11, 8), max_pix_value=8):
if state.shape[::-1] == target_shape:
resized = state
else:
resized = cv2.resize(state, target_shape, interpolation=cv2.INTER_AREA)
img = ((resized / 255.0) * max_pix_value).astype(np.int8)
return img