code: def preprocess(img):
      
      # Crop the image.
      img = img[35:195]
      # Downsample by factor of 2.
      img = img[::2, ::2, 0]
      # Erase background (background type 1).
      img[img == 144] = 0
      # Erase background (background type 2).
      img[img == 109] = 0
      # Set everything else (paddles, ball) to 1.
      img[img != 0] = 1
      return img.astype(np.float).ravel()
docs: Preprocess 210x160x3 uint8 frame into 6400 (80x80) 1D float vector.