Skip to content

Commit

Permalink
Merge pull request IntelRealSense#1307 from jangernert/net_disparity_…
Browse files Browse the repository at this point in the history
…transform

[NET wrapper] depth<->disparity transform processing block
  • Loading branch information
dorodnic authored Mar 19, 2018
2 parents 0945c25 + 567fa48 commit dbd3133
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wrappers/csharp/Intel.RealSense/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ internal static extern int rs2_poll_for_frame(IntPtr queue,
[DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr rs2_create_spatial_filter_block([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Helpers.ErrorMarshaler))] out object error);

[DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr rs2_create_disparity_transform_block(byte transform_to_disparity, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Helpers.ErrorMarshaler))] out object error);


#endregion
#region rs_option
Expand Down
22 changes: 22 additions & 0 deletions wrappers/csharp/Intel.RealSense/Processing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,28 @@ public FrameSet Process(FrameSet original)
FrameQueue queue;
}

public class DisparityTransform : ProcessingBlock
{
public DisparityTransform(bool transform_to_disparity = true)
{
object error;
byte transform_direction = transform_to_disparity ? (byte)1 : (byte)0;
m_instance = new HandleRef(this, NativeMethods.rs2_create_disparity_transform_block(transform_direction, out error));
queue = new FrameQueue();
NativeMethods.rs2_start_processing_queue(m_instance.Handle, queue.m_instance.Handle, out error);
}

public VideoFrame ApplyFilter(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;
}

FrameQueue queue;
}

public class DecimationFilter : ProcessingBlock
{
public DecimationFilter()
Expand Down

0 comments on commit dbd3133

Please sign in to comment.