コード例 #1
0
        public void StartRecording(RecordingParameters parameters)
        {
            if (state_ != State.Running)
            {
                var param   = parameters as RecordingParameters;
                var monitor = NativeRecorder.GetMonitor(param.Monitor);
                if (monitor == null || monitor.Width <= 0 || monitor.Height <= 0)
                {
                    Debug.LogErrorFormat("Failed to get monitor ({0}) informaiton", param.Monitor);
                    return;
                }

                monitorNumber_ = param.Monitor;

                int res = NativeRecorder.StartRecording(monitor.Width, monitor.Height, param.RecordLength, param.Fps, param.Quality);
                state_ = State.Running;

                recordingTimer_.Reset(); // need?
                recordingTimer_.Start();

                fps_ = param.Fps;
                msList.Clear();
                msList.Enqueue(recordingTimer_.ElapsedMilliseconds);

                startFrameCaptureThread();
                startFrameEncodeThread();
                Debug.Log("StartRecording: result=" + (APIResult)res);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Baldins/crowd_perception
    static void Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("Usage : Only the path of the output SVO file should be passed as argument.");
            Environment.Exit(-1);
        }
        // Create ZED Camera
        Camera zed = new Camera(0);

        Console.CancelKeyPress += delegate {
            Console.WriteLine("close");
            zed.DisableRecording();
            zed.Close();
        };

        //Specify SVO path parameters
        InitParameters initParameters = new InitParameters()
        {
            resolution = RESOLUTION.HD2K,
            depthMode  = DEPTH_MODE.NONE,
        };

        ERROR_CODE state = zed.Open(ref initParameters);

        if (state != ERROR_CODE.SUCCESS)
        {
            Environment.Exit(-1);
        }

        string pathOutput = args[0];

        RecordingParameters recordingParams = new RecordingParameters(pathOutput, SVO_COMPRESSION_MODE.H264_BASED, 8000, 15, false);

        state = zed.EnableRecording(recordingParams);
        if (state != ERROR_CODE.SUCCESS)
        {
            zed.Close();
            Environment.Exit(-1);
        }

        // Start recording SVO, stop with Q
        Console.WriteLine("SVO is recording, press Q to stop");
        int framesRecorded = 0;

        RuntimeParameters rtParams = new RuntimeParameters();

        while (true)
        {
            if (zed.Grab(ref rtParams) == ERROR_CODE.SUCCESS)
            {
                // Each new frame is added to the SVO file
                framesRecorded++;
                Console.WriteLine("Frame count: " + framesRecorded);
            }

            bool State = (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Q) == true);
            if (State)
            {
                break;
            }
        }

        // Stop recording
        zed.DisableRecording();
        zed.Close();
    }