class_docstr: Atari wrapper that matches exactly Dopamine's prepocessing.
  
  Warning: using this wrapper requires that you have opencv and its dependencies
  installed. In general, opencv is not required for Acme.
docstr: Preprocess Atari frames.
docstr_tok: ["Preprocess","Atari","frames","."]
code: def _preprocess_pixels(self, timestep_stack: List[dm_env.TimeStep]):
      """Preprocess Atari frames."""
  
      # 1. RBG to grayscale
      def rgb_to_grayscale(obs):
          if self._grayscaling:
              return np.tensordot(
                  obs, [0.2989, 0.5870, 0.1140], (-1, 0)
              )
          return obs
  
      # 2. Max pooling
      processed_pixels = np.max(
          np.stack(
              [
                  rgb_to_grayscale(
                      s.observation[atari_wrapper.RGB_INDEX]
                  )
                  for s in timestep_stack[-self._pooled_frames :]
              ]
          ),
          axis=0,
      )
  
      # 3. Resize
      processed_pixels = np.round(processed_pixels).astype(np.uint8)
      if self._scale_dims != processed_pixels.shape[:2]:
          processed_pixels = cv2.resize(
              processed_pixels,
              (self._width, self._height),
              interpolation=cv2.INTER_AREA,
          )
  
          processed_pixels = np.round(processed_pixels).astype(np.uint8)
  
      return processed_pixels
  
file_path: acme/acme/wrappers/atari_wrapper_dopamine.py
imports: from typing import List
  from acme.wrappers import atari_wrapper
  import cv2
  import dm_env
  import numpy
label_desc: Use image node_id 1 for calling the AtariWrapperDopamine obj's underlying member method code with example usage: obj._preprocess_pixels(timestep_stack) and returns: processed_pixels, obs, np