/// <summary> /// This method is used to pass frame into a processing block /// </summary> /// <param name="f">frame to process</param> public void SubmitFrame(Frame f) { object error; NativeMethods.rs2_frame_add_ref(f.Handle, out error); NativeMethods.rs2_process_frame(Handle, f.Handle, out error); }
public void SubmitFrame(Frame f, FramesReleaser releaser = null) { object error; NativeMethods.rs2_frame_add_ref(f.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, f.m_instance.Handle, out error); }
public Frame Clone() { object error; NativeMethods.rs2_frame_add_ref(m_instance.Handle, out error); return(new Frame(m_instance.Handle)); }
public void FrameReady(Frame f) { object error; NativeMethods.rs2_frame_add_ref(f.m_instance.Handle, out error); NativeMethods.rs2_synthetic_frame_ready(m_instance.Handle, f.m_instance.Handle, out error); }
public FrameSet AllocateCompositeFrame(IList <Frame> frames) { if (frames == null) { throw new ArgumentNullException(nameof(frames)); } IntPtr frame_refs = IntPtr.Zero; try { object error; int fl = frames.Count; frame_refs = Marshal.AllocHGlobal(fl * IntPtr.Size); for (int i = 0; i < fl; i++) { var fr = frames[i].m_instance.Handle; Marshal.WriteIntPtr(frame_refs, i * IntPtr.Size, fr); NativeMethods.rs2_frame_add_ref(fr, out error); } var frame_ref = NativeMethods.rs2_allocate_composite_frame(m_instance.Handle, frame_refs, fl, out error); return(FrameSet.Create(frame_ref)); } finally { if (frame_refs != IntPtr.Zero) { Marshal.FreeHGlobal(frame_refs); } } }
public void ProcessFrame(Frame f) { object error; NativeMethods.rs2_frame_add_ref(f.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, f.m_instance.Handle, out error); }
private void FrameReady(IntPtr ptr) { object error; NativeMethods.rs2_frame_add_ref(ptr, out error); NativeMethods.rs2_synthetic_frame_ready(m_instance.Handle, ptr, out error); }
/// <summary> /// Add a reference to this frame and return a clone, does not copy data /// </summary> /// <returns>A clone of this frame</returns> public Frame Clone() { object error; NativeMethods.rs2_frame_add_ref(Handle, out error); return(Create(Handle)); }
public void Enqueue(Frame f) { object error; NativeMethods.rs2_frame_add_ref(f.m_instance.Handle, out error); NativeMethods.rs2_enqueue_frame(f.m_instance.Handle, m_instance.Handle); }
public Frame AsFrame() { object error; NativeMethods.rs2_frame_add_ref(m_instance.Handle, out error); return(CreateFrame(m_instance.Handle)); }
public VideoFrame Colorize(VideoFrame original) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(queue.WaitForFrame() as VideoFrame); }
public Points Calculate(Frame original) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(queue.WaitForFrame() as Points); }
public FrameSet Process(FrameSet original) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(queue.WaitForFrames()); }
public FrameSet Process(FrameSet original, FramesReleaser releaser = null) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(FramesReleaser.ScopedReturn(releaser, queue.WaitForFrames() as FrameSet)); }
public VideoFrame Colorize(VideoFrame original, FramesReleaser releaser = null) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(FramesReleaser.ScopedReturn(releaser, queue.WaitForFrame() as VideoFrame)); }
public void MapTexture(VideoFrame texture) { object error; Options[Option.TextureSource].Value = Convert.ToSingle(texture.Profile.UniqueID); NativeMethods.rs2_frame_add_ref(texture.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, texture.m_instance.Handle, out error); }
public Points Calculate(Frame original, FramesReleaser releaser = null) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); return(FramesReleaser.ScopedReturn(releaser, queue.WaitForFrame() as Points)); }
/// <summary>Returns a strongly-typed clone</summary> /// <typeparam name="T"><see cref="Frame"/> type or subclass</typeparam> /// <param name="other"><see cref="Frame"/> to clone</param> /// <returns>an instance of <typeparamref name="T"/></returns> public static T Create <T>(Frame other) where T : Frame { object error; NativeMethods.rs2_frame_add_ref(other.Handle, out error); return(ObjectPool.Get <T>(other.Handle)); }
/// <summary> /// This method is used to pass frames into a processing block /// </summary> /// <typeparam name="T"><see cref="Frame"/> type or subclass</typeparam> /// <param name="f">Frame to process</param> public void Process <T>(T f) where T : Frame { object error; NativeMethods.rs2_frame_add_ref(f.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, f.Handle, out error); }
public void MapTo(Frame mapped) { this.Options.Where(s => s.Key == Option.TextureSource).First().Value = mapped.Profile.UniqueID; object error; NativeMethods.rs2_frame_add_ref(mapped.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, mapped.m_instance.Handle, out error); }
public T As <T>() where T : Frame { using (this) { object error; NativeMethods.rs2_frame_add_ref(m_instance.Handle, out error); return(Create <T>(m_instance.Handle)); } }
public static FrameSet FromFrame(Frame composite) { if (composite.IsComposite) { object error; NativeMethods.rs2_frame_add_ref(composite.m_instance.Handle, out error); return(FrameSet.Pool.Get(composite.m_instance.Handle)); } throw new ArgumentException("The frame is a not composite frame", nameof(composite)); }
public void MapTexture(VideoFrame texture) { object error; Options[Option.StreamFilter].Value = Convert.ToSingle(texture.Profile.Stream); Options[Option.StreamFormatFilter].Value = Convert.ToSingle(texture.Profile.Format); Options[Option.StreamIndexFilter].Value = Convert.ToSingle(texture.Profile.Index); NativeMethods.rs2_frame_add_ref(texture.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, texture.m_instance.Handle, out error); }
public static FrameSet FromFrame(Frame composite, FramesReleaser releaser = null) { object error; if (NativeMethods.rs2_is_frame_extendable_to(composite.m_instance.Handle, Extension.CompositeFrame, out error) > 0) { NativeMethods.rs2_frame_add_ref(composite.m_instance.Handle, out error); return(FramesReleaser.ScopedReturn(releaser, new FrameSet(composite.m_instance.Handle))); } throw new Exception("The frame is a not composite frame"); }
public FrameSet AllocateCompositeFrame(FramesReleaser releaser, params Frame[] frames) { object error; var frame_refs = frames.Select(x => x.m_instance.Handle).ToArray(); foreach (var fref in frame_refs) { NativeMethods.rs2_frame_add_ref(fref, out error); } var frame_ref = NativeMethods.rs2_allocate_composite_frame(m_instance.Handle, frame_refs, frames.Count(), out error); return(FramesReleaser.ScopedReturn(releaser, new FrameSet(frame_ref))); }
/// <summary> /// Process frame and return the result /// </summary> /// <param name="original"></param> /// <returns></returns> public Frame Process(Frame original) { object error; NativeMethods.rs2_frame_add_ref(original.m_instance.Handle, out error); NativeMethods.rs2_process_frame(m_instance.Handle, original.m_instance.Handle, out error); Frame f; if (queue.PollForFrame(out f)) { return(f); } return(original); }
/// <summary> /// Process frame and return the result /// </summary> /// <typeparam name="T">Type of frame to return</typeparam> /// <param name="original">Frame to process</param> /// <returns>Processed frame</returns> /// <exception cref="InvalidOperationException">Thrown when errors occur during processing</exception> public T Process <T>(Frame original) where T : Frame { object error; NativeMethods.rs2_frame_add_ref(original.Handle, out error); NativeMethods.rs2_process_frame(Handle, original.Handle, out error); T f; if (queue.PollForFrame <T>(out f)) { return(f); } // this occurs when the sdk runs out of frame resources and allocate_video_frame fails // sadly, that exception doesn't propagate here... // usually a sign of not properly disposing of frames throw new InvalidOperationException($"Error while running {GetType().Name} processing block, check the log for info"); }