Exemple #1
0
        /// <summary>
        /// Sets up a frame callback that is called immediately when an image is available,
        /// with no synchronization logic applied.
        /// </summary>
        /// <param name="onFrame">The function to be called whenever a new image is available.</param>
        public void Start(FrameCallback onFrame)
        {
            if (onFrame == null)
            {
                throw new ArgumentNullException(nameof(onFrame));
            }

            frameCallback = (frame, user) =>
            {
                var frameHandle = new FrameHandle(frame);
                onFrame(new Frame(frameHandle, this));
            };
            NativeMethods.rs2_start(handle, frameCallback, IntPtr.Zero, out IntPtr error);
            NativeHelper.ThrowExceptionForRsError(error);
        }
Exemple #2
0
 internal Frame(FrameHandle frame, Sensor sensor)
 {
     handle = frame ?? throw new ArgumentNullException(nameof(frame));
     Sensor = sensor;
 }