Start D435i with C#
Hi,
I want to start a new C# solution of realsense.
My steps are as follow:
1. Creat a new C# solution. I add "Intel.Realsense.dll"(x64) to reference.
2. I can't add "realsense2.dll" to reference.So I copy "realsense2.dll" (from Intel RealSense SDK 2.0\bin\x64) to the Debug file of my solution.
3. I execute the code:
var pipe = new Pipeline(); pipe.Start(); while (true) { using (var frames = pipe.WaitForFrames()) using (var depth = frames.DepthFrame) { Console.WriteLine("The camera is pointing at an object " + depth.GetDistance(depth.Width / 2, depth.Height / 2) + " meters away\t"); Console.SetCursorPosition(0, 0); } }
the error occurs at line:
using (var frames = pipe.WaitForFrames())
it shows "System.Exception: 'Frame didn't arrive within 5000'
ExternalException: rs2_pipeline_wait_for_frames(pipe:0000000021A2BA30) "
my platform is WIN10 , Visual Studio 2017 , SDK version 2.32.1
I tried the C# wrappers and Intel RealSense Viewer,and they worked perfectly, so I think my camera and cable are fine.
And I want to know what steps I missed or did it wrong?
THX!
-
Dorodnic the RealSense SDK Manager advised a user who had the same exception that as well as wrapping the code in a 'using' block (which you have done), dispose should be used.
https://github.com/IntelRealSense/librealsense/issues/2845#issuecomment-444448923
Please sign in to leave a comment.
Comments
1 comment