본문 바로가기

프로그래밍/Intel RealSense

Intel RealSense SDK2.0 for C# and C++/CLI

Reference1: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/csharp#building

 

IntelRealSense/librealsense

Intel® RealSense™ SDK. Contribute to IntelRealSense/librealsense development by creating an account on GitHub.

github.com

Reference2: https://cccommunications.com/intel-realsense-3d-depth-camera-sdk-setup-for-c-development/

 

Intel RealSense 3D Depth Camera SDK Setup for C# Development - CC Communications

We’re developing a custom computer vision client application to measure the square footage of product as it moves along the production line. The Intel camera produces a 3D point cloud of objects in its field of view which can be used to calculate distance,

cccommunications.com

Step 1. Build the provided C++/C# samples using the instructions located in the main repo under /wrappers/csharp/readme.md

  • Generate the VS solution using cmake (run from librealsense root dir):

    • mkdir build
    • cd build
    • cmake .. -DBUILD_CSHARP_BINDINGS=ON -DBUILD_SHARED_LIBS=ON
  • The file realsense2.sln should be created in build folder, open the file with Visual Studio, C# examples and library will be available in the solution under Wrappers/csharp.

Both the native library and the .NET wrapper are built by default as part of the examples dependencies.

Step 2. Take a look at the working samples for reference. The default librealsense build on Windows is Debug/Win32 (For this config, built samples will be available at your_librealsense_dir/build/Debug)

In your C# project you need to have Intel.RealSense.dll added as a reference and copy realsense2.dll in your build directory ex: your_project_home/bin/x86/Debug

 

 

1. CMake로 VS 솔루션 생성 후 root의 솔루션을 실행하여 INSTALL을 빌드한다.

2. 빌드가 안될 경우 CMake에서 CMAKE_INSTALL_PREFIX가 C\prograC:\Program Files\librealsense2 이런식으로 되어있는지 확인하고 맞다면 비주얼 스튜디오를 관리자 권한으로 열어서 실행한다. 또 다른 방법은 path를 관리자 권한이 필요없는 다른 폴더로 지정하면 된다.

3. [Intel.RealSense.dll] 와 [realsense2.dll] 를 CMAKE_INSTALL_PREFIX 경로에서 찾아서 복사한 후 새로 생성한 프로젝트 폴더에 넣는다.

4. 여기서 만약 C# 이라면, DLL 파일을 project_home/bin/x64/Debug 경로로 넣고,

   만약 C++/CLI 라면, DLL 파일을 그냥 project_home에 넣는다.

5. C#: using Intel.RealSense;

   C++/CLI: using namespace Intel::RealSense;

 

 

참고로 CMake로 DLL을 만들 필요 없이, SDK installer를

깔면 C:\Program Files (x86)\Intel RealSense SDK 2.0\bin\x64 경로에 DLL이 위치하므로 그냥 이용하면 된다.