class_docstr: Convert the image observation from RGB to gray scale.
  
  Example:
      >>> env = gym.make('CarRacing-v1')
      >>> env.observation_space
      Box(0, 255, (96, 96, 3), uint8)
      >>> env = GrayScaleObservation(gym.make('CarRacing-v1'))
      >>> env.observation_space
      Box(0, 255, (96, 96), uint8)
      >>> env = GrayScaleObservation(gym.make('CarRacing-v1'), keep_dim=True)
      >>> env.observation_space
      Box(0, 255, (96, 96, 1), uint8)
docstr: Converts the colour observation to greyscale.
  
  Args:
      observation: Color observations
  
  Returns:
      Grayscale observations
docstr_tok: ["Converts","the","colour","observation","to","greyscale",".","Args",":","observation",":","Color","observations","Returns",":","Grayscale","observations"]
code: def observation(self, observation):
      """Converts the colour observation to greyscale.
  
      Args:
          observation: Color observations
  
      Returns:
          Grayscale observations
      """
      import cv2
  
      observation = cv2.cvtColor(observation, cv2.COLOR_RGB2GRAY)
      if self.keep_dim:
          observation = np.expand_dims(observation, -1)
      return observation
  
imports: import numpy
  import gym
  from gym.spaces import Box
label_desc: Use image node_id 2 for calling the GrayScaleObservation obj's underlying member method code with example usage: obj.observation(observation) and returns: observation