public static DataCaptureScript GetCameraCaptureForRecording() { AirSimSettings.CamerasSettings recordCamSettings = AirSimSettings.GetSettings().Recording.Cameras[0]; DataCaptureScript recordCam = Vehicles[0].VehicleInterface.GetCameraCapture(recordCamSettings.CameraName); return(recordCam); }
//Thread to capture the images and save them to documents. This will be started by pressing the Record button on HUD. private IEnumerator CaptureFrames() { AirSimSettings.CamerasSettings recordCamSettings = AirSimSettings.GetSettings().Recording.Cameras[0]; SetUpRenderType((ImageType)recordCamSettings.ImageType); SetUpRenderTextureForCapture((ImageType)recordCamSettings.ImageType); while (isCapturing) { yield return(waitForEndOfFrame); RenderTexture.active = renderTexture; screenShot.ReadPixels(captureRect, 0, 0); screenShot.Apply(); byte[] bytes = screenShot.EncodeToPNG(); RenderTexture.active = null; DataRecorder.ImageData data = VehicleCompanion.GetRecordingData(); data.image = bytes; recorder.AddImageDataToQueue(data); yield return(waitUntilNext); } }