static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: "); Console.WriteLine(" ZED_SVO_Playback <SVO_file> "); Console.WriteLine("* *SVO file is mandatory in the application * *"); Environment.Exit(-1); } // Create ZED Camera Camera zed = new Camera(0); //Specify SVO path parameters InitParameters initParameters = new InitParameters() { inputType = INPUT_TYPE.SVO, pathSVO = args[0], svoRealTimeMode = true, depthMode = DEPTH_MODE.PERFORMANCE }; ERROR_CODE state = zed.Open(ref initParameters); if (state != ERROR_CODE.SUCCESS) { Environment.Exit(-1); } Resolution resolution = zed.GetCalibrationParameters().leftCam.resolution; // Define OpenCV window size (resize to max 720/404) Resolution lowResolution = new Resolution((uint)Math.Min(720, (int)resolution.width) * 2, (uint)Math.Min(404, (int)resolution.height)); sl.Mat svoImage = new sl.Mat(); svoImage.Create(lowResolution, MAT_TYPE.MAT_8U_C4); OpenCvSharp.Mat svoImageOCV = SLMat2CVMat(ref svoImage, MAT_TYPE.MAT_8U_C4); //Setup key, images, times char key = ' '; Console.WriteLine("Press 's' to save SVO image as PNG"); Console.WriteLine("Press 'f' to jump forward in the video"); Console.WriteLine("Press 'b' to jump backard in the video"); Console.WriteLine("Press 'q' to exit..."); int svoFrameRate = zed.GetInitParameters().cameraFPS; int nbFrames = zed.GetSVONumberOfFrames(); Console.WriteLine("[INFO] SVO contains " + nbFrames + " frames"); RuntimeParameters rtParams = new RuntimeParameters(); // Start SVO Playback while (key != 'q') { state = zed.Grab(ref rtParams); if (state == ERROR_CODE.SUCCESS) { //Get the side by side image zed.RetrieveImage(svoImage, VIEW.SIDE_BY_SIDE, MEM.CPU, lowResolution); int svoPosition = zed.GetSVOPosition(); //Display the frame Cv2.ImShow("View", svoImageOCV); key = (char)Cv2.WaitKey(10); switch (key) { case 's': svoImage.Write("capture" + svoPosition + ".png"); break; case 'f': zed.SetSVOPosition(svoPosition + svoFrameRate); break; case 'b': zed.SetSVOPosition(svoPosition - svoFrameRate); break; } ProgressBar((float)svoPosition / (float)nbFrames, 30); } else if (zed.GetSVOPosition() >= nbFrames - (zed.GetInitParameters().svoRealTimeMode ? 2 : 1)) { Console.WriteLine("SVO end has been reached. Looping back to 0"); zed.SetSVOPosition(0); } else { Console.WriteLine("Grab Error : " + state); break; } } zed.Close(); }