def _observation(self, observation):
        """ Paper: First, to encode a single frame we take the maximum value for each pixel colour
                value over the frame being encoded and the previous frame. This was necessary to
                remove flickering that is present in games where some objects appear only in even
                frames while other objects appear only in odd frames, an artefact caused by the
                limited number of sprites Atari 2600 can display at once. """

        obs = np.maximum(observation, self.previous_frame)
        self.previous_frame = observation

        """ Paper: Second, we then extract
        the Y channel, also known as luminance, from the RGB frame and rescale it to
        84 x 84 """
        img = Image.fromarray(obs)
        obs = img.resize([84, 84]).convert('L')

        obs = np.asarray(obs, dtype=np.uint8)

        return obs
def _observation ( self , observation ) : obs = np . maximum ( observation , self . previous_frame ) self . previous_frame = observation """ Paper: Second, we then extract
        the Y channel, also known as luminance, from the RGB frame and rescale it to
        84 x 84 """ img = Image . fromarray ( obs ) obs = img . resize ( [ 84 , 84 ] ) . convert ( 'L' ) obs = np . asarray ( obs , dtype = np . uint8 ) return obs
Paper: First, to encode a single frame we take the maximum value for each pixel colour
                value over the frame being encoded and the previous frame. This was necessary to
                remove flickering that is present in games where some objects appear only in even
                frames while other objects appear only in odd frames, an artefact caused by the
                limited number of sprites Atari 2600 can display at once.