C# (.NET)
These examples demonstrate how to use the .NET wrapper with the Intel RealSense SDK.
They demonstrate how to easily use the SDK to include code snippets that access the camera into your applications.
Intel RealSense SDK 2.0 Installation Guidelines
Installation guidelines with CMake and Visual Studio, Core CLI and Mono are on GitHub
List of Intel RealSense SDK 2.0 Examples
Hello World
Here is a minimal depth application written in C#:
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);
}
}
Note:
Since the SDK is holding-on to native hardware resources, it is critical to make sure you deterministically dispose of objects, especially those derived from Frame. Without releasing resources explicitly the Garbage Collector will not keep-up with new frames being allocated.
Example | Description | Link to GitHub |
---|---|---|
Depth | Streams depth frames for a headless device | cs-tutorial-depth |
Capture | Captures depth and color and renders to side-by-side windows | cs-tutorial-capture |
Processing | Aligns depth to color and applies the post processing filters | cs-tutorial-processing |
Software development | Demonstrates usage of the software_device object, which allows users to create and control custom SDK device | cs-tutorial-software-dev |
Pose | Demonstrates how to obtain data from pose frames | cs-tutorial-pose |
Updated almost 2 years ago