Skip to content

C# SDK Configuration

Runtime Environment Setup

In the Windows environment, RVC SDK will automatically add the runtime libraries into the system path during the installation process, you can check the runtime libraries information in the file under the installation directory:

/RVCSDK/examples/CSharp/CMakeLists.txt

When using RVC SDK for C# development, you need to follow the steps in this section to complete the environment configuration and example compilation, and copy all RVC_C.dll, RVC_CSharp.dll, and RVC_CSharp_Extension.dll files in the bin/Debug folder to the same directory of the .exe executable program.

The following describes the steps to configure the C# runtime environment on Win 10 system.

1. Install CMake

Download CMake from https://cmake.org/download/.

CMakeDownload

Download the .msi file for the current system version. When installing CMake, you need to add CMake to the system path for all users.

CMakeInstall

2. Install Visual Studio

Recommended version: VS 2019 or VS 2017.

3. Install C# workloads

Open Visual Studio Installer and click [Modify].

VSInstaller_en

Open the "Workloads" tab, check ".NET desktop development" and "Desktop development with C++", and click [Modify] to install C# workloads.

CSharpWorkloads_en

Open the solution RVC_CSharp in Visual Studio, if the project displays "Uninstalled" or "Unloaded", open the Visual Studio Installer again and click [Modify]. NET Framework 4.6.1 targeting pack and .NET Framework 4.6.1 SDK in the "Individual components" tab, and then click [Modify] to install them. After the installation is complete, select the project, right-click and select "Reload Project".

CSharpComponents_en

Running the Examples

1. Create the build folder

Go to the installation directory: /RVCSDK/examples/CSharp and create the build folder manually.

2. Use CMake to generate the project

Open CMake and configure the following two items.

Where is the source code - Select the path under the installation directory: /RVCSDK/examples/CSharp.

Where to build the binaries - Select the path under the installation directory: /RVCSDK/examples/CSharp/build

Click [Configure], select the VS version to use (VS 16 2019 is recommended), select x64 for the project platform, and click [Finish].

CMakex64

If you need to convert the acquired data to Halcon or VisionPro format, you need to obtain Halcon or VisionPro license first, and check Halcon_Enable or VisionPro_Enable in the CMake configuration process.

CSharpCMakeDone

After configuration, it prompts Configuring done. Click Generate, it prompts Generating done.

3. Build the solution

Open the solution RVC_CSharp in Visual Studio. In the Solution Explorer, select the solution "RVC_CSharp", right-click and select "Build Solution".

CSharpGenerate_en

When the build is complete, select the example you want to run, right-click and select "Set as Startup Project".

CSharpStartProject_en

Select Debug | x64 in the menu bar and click "Start".

CSharpStartRun_en

After the example finishes running, the point clouds, 2D images, and depth maps will be categorized by the name of the capturing device, and saved in the folder of the current execution path by default:

/RVCSDK/examples/CSharp/build/bin/Debug