def observation(self, obs):
    if (self._key is None):
        frame = obs
    else:
        frame = obs[self._key]
    if self._grayscale:
        frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
    frame = cv2.resize(frame, (self._width, self._height), interpolation=cv2.INTER_AREA)
    if self._grayscale:
        frame = np.expand_dims(frame, (- 1))
    if (self._key is None):
        obs = frame
    else:
        obs = obs.copy()
        obs[self._key] = frame
    return obs
def observation(self, obs):
    if (self._key is None):
        frame = obs
    else:
        frame = obs[self._key]
    if self._grayscale:
        frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
    frame = cv2.resize(frame, (self._width, self._height), interpolation=cv2.INTER_AREA)
    if self._grayscale:
        frame = np.expand_dims(frame, (- 1))
    if (self._key is None):
        obs = frame
    else:
        obs = obs.copy()
        obs[self._key] = frame
    return obs