def get_image(self, base_object, mode="bgr"):
        """
        Put camera to an object and get the image.
        """
        original_parent = self.cam.getParent()
        original_position = self.cam.getPos()
        original_hpr = self.cam.getHpr()
        self.cam.reparentTo(base_object.origin)
        img = self.get_rgb_array_cpu()
        self.track(original_parent, original_position, original_hpr)
        if mode == "bgr":
            return img
        elif mode == "rgb":
            return img[..., ::-1]
        else:
            raise ValueError("Unknown mode: {}".format(mode))

        Put camera to an object and get the image.
        
metadrive/component/sensors/base_camera.py