def get_rgb_array_cpu(self):
        """
        Get the rgb array on CPU, which suffers from the latency of moving data from graphics card to memory
        """
        origin_img = self.buffer.getDisplayRegion(1).getScreenshot()
        img = np.frombuffer(origin_img.getRamImage().getData(), dtype=np.uint8)
        img = img.reshape((origin_img.getYSize(), origin_img.getXSize(), -1))
        img = img[..., :self.num_channels]
        img = img[::-1]
        return img

        Get the rgb array on CPU, which suffers from the latency of moving data from graphics card to memory
        
metadrive/engine/core/image_buffer.py