stereolabs / zed-csharp-api

C# API for the ZED SDK
MIT License
10 stars 3 forks source link
c-sharp dotnet stereo-vision zed-camera

Stereolabs.Net - C#/.NET API

This package lets you use the ZED stereo camera in C#. The C# API is a wrapper around the ZED SDK which is written in C++ optimized code. We make the ZED SDK accessible from external C# code.

Getting started

Prerequisites

From NuGet

The C# API is available as a Nuget Package on Nuget.org.

Package Description Link
Stereolabs.zed .NET Wrapper that imports the functions from the interface NuGet version

Add the package to your Project

To add a NuGet pacakge to your project, please follow this documentation.

From Sources

It is also possible to build the wrapper from the sources. The C# wrapper made of two libraries :

Build the C# wrapper

Build the C wrapper

The Csharp wrapper is using the C wrapper to interface with the ZED SDK. Therefore, you also need to build it following the same step as before.

Add the wrapper to your Project

Usage

Here is an example of the .NET API.

using System.Numerics;

namespace sl
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create the camera
            Camera zedCamera = new Camera(0);
            // Create default configuration parameters
            InitParameters init_params = new InitParameters();
            ERROR_CODE err = zedCamera.Open(ref init_params);
            if (err != ERROR_CODE.SUCCESS)
                Environment.Exit(-1);

            // Get camera information (serial number)
            int zed_serial = zedCamera.GetZEDSerialNumber();
            Console.WriteLine("Hello! This is my serial number: " + zed_serial);
            Console.ReadLine();

            zedCamera.Close();
        }
    }
}

Support

If you need assistance go to our Community site at https://community.stereolabs.com/