def _format(self, ret, to_float):
        """
        Format the image to the desired type, float32 or uint8
        """
        if not to_float:
            return ret.astype(np.uint8, copy=False, order="C")
        else:
            return ret / 255

        Format the image to the desired type, float32 or uint8
        
metadrive/component/sensors/base_camera.py