diff --git a/CMakeLists.txt b/CMakeLists.txt index e925c4c..972d39d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,61 +1,33 @@ cmake_minimum_required(VERSION 3.8.2) project(ob_csharp VERSION 0.1.0 LANGUAGES CSharp) +set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) include(CSharpUtilities) file(GLOB_RECURSE SOURCES src/*.cs) -# add_library(${PROJECT_NAME} SHARED -# src/CameraParamList.cs -# src/Config.cs -# src/Context.cs -# src/DepthWorkModeList.cs -# src/Device.cs -# src/DeviceInfo.cs -# src/DeviceList.cs -# src/CameraParamList.cs -# src/Error.cs -# src/Filter.cs -# src/FilterConfigSchemaList.cs -# src/Frame.cs -# src/NativeException.cs -# src/NativeHandle.cs -# src/obNative.cs -# src/Pipeline.cs -# src/Sensor.cs -# src/SensorList.cs -# src/StreamProfile.cs -# src/StreamProfileList.cs -# src/Recorder.cs -# src/Playback.cs -# src/Types.cs -# src/Version.cs -# ) - add_library(${PROJECT_NAME} SHARED ${SOURCES}) set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION 4.7.2) -set(OB_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/OrbbecSDK/lib) -message("OB_LIB_DIR: ${OB_LIB_DIR}") - add_subdirectory(samples) file(GLOB OB_SDK_LIB_FILES ${CMAKE_CURRENT_LIST_DIR}/OrbbecSDK/lib/OrbbecSDK.dll) file(GLOB OB_SDK_EXT_DIR ${CMAKE_CURRENT_LIST_DIR}/OrbbecSDK/lib/extensions) file(GLOB OB_SDK_CONFIG_FILES ${CMAKE_CURRENT_LIST_DIR}/OrbbecSDK/config/OrbbecSDKConfig.*) -install (FILES ${OB_SDK_LIB_FILES} DESTINATION bin) -install (DIRECTORY ${OB_SDK_EXT_DIR} DESTINATION bin) -install (FILES ${OB_SDK_CONFIG_FILES} DESTINATION bin) -install (FILES ${OB_SDK_LIB_FILES} DESTINATION lib) -install (DIRECTORY ${OB_SDK_EXT_DIR} DESTINATION lib) -install (FILES ${OB_SDK_CONFIG_FILES} DESTINATION lib) +install (FILES ${OB_SDK_LIB_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install (DIRECTORY ${OB_SDK_EXT_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install (FILES ${OB_SDK_CONFIG_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + +install (FILES ${OB_SDK_LIB_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install (DIRECTORY ${OB_SDK_EXT_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install (FILES ${OB_SDK_CONFIG_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ) \ No newline at end of file diff --git a/README.md b/README.md index be8ad18..6cb90dd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,57 @@ # Orbbec SDK C# Wrapper This is a wrapper for the Orbbec SDK for C#. It provides a simple and easy-to-use interface for accessing the Orbbec camera and performing various operations such as capturing depth images, color images, and performing point cloud generation. + +The v2-main branch, C# Wrapper is based the open source version of [Orbbec SDK v2](https://github.com/orbbec/OrbbecSDK_v2). The C# wrapper for the open-source [Orbbec SDK v2](https://github.com/orbbec/OrbbecSDK_v2) is versioned as v2.x.x, while the C# wrapper for the [Orbbec SDK v1](https://github.com/orbbec/OrbbecSDK) is versioned as v1.x.x. + +# Support Platforms +- Windows: Windows 10 (x64) + +# Platform support +| **Products List** | **Firmware Version** | +|-------------------|-----------------------------| +| Gemini 335 | 1.2.20 | +| Gemini 335L | 1.2.20 | +| Gemini 336 | 1.2.20 | +| Gemini 336L | 1.2.20 | + +# Compile and run sample +Here, it is assumed that you have installed Cmake correctly. If you have not installed Cmake, you can refer to the Cmake official website for installation. +- Open Cmake, set the source code path, and set the “build” folder as the path for generating binary files, as shown in the following figure. + +- First, click Configure, then select x64 in the dialog box that appears, and finally click Finish. +![compile-1](image/compile-1.png) + +- Click “Generate”, as shown below: +![compile-2](image/compile-2.png) + +- Use the file explorer to directly start the Visual Studio project in the build directory, as shown in the following figure: +![compile-3](image/compile-3.png) + +- Open the project, as shown below, First, select Release, then choose ALL BUILD to compile, and finally select INSTALL. +![compile-4](image/compile-4.png) + +- The compiled sample is located in the build/install/bin directory. +![compile-5](image/compile-5.png) +- Click on 0.basic.quick_start.exe, and the running result is as follows: +![compile-6](image/compile-6.png) + +# Sample Features +| Example | Description | level | +| --------------------- | ------------------------ |----------------| +| 0.basic.quick_start | Quickly use the camera to capture color and depth video streams.| ⭐ | +| 1.stream.color | Displays the color stream from the camera.| ⭐ | +| 1.stream.depth | Displays the depth stream from the camera.| ⭐ | +| 1.stream.imu | Demonstrates how to read IMU data.| ⭐ | +| 1.stream.infrared | Displays the infrared stream from the camera.| ⭐ | +| 1.stream.multi_streams | Use SDK to obtain multiple camera data streams and output them.| ⭐ | +| 2.device.control | The SDK can be used to modify camera-related parameters, including laser switch, laser level intensity, white balance switch, etc.| ⭐⭐ | +| 2.device.firmware_update | This sample demonstrates how to read a firmware file to perform firmware upgrades on the device.| ⭐⭐ | +| 2.device.hot_plugin | Demonstrates how to detect hot plug events.| ⭐⭐ | +| 3.advanced.coordinate_transform | Use the SDK interface to transform different coordinate systems.| ⭐⭐⭐ | +| 3.advanced.hw_d2c_align | Demonstrates how to use hardware D2C.| ⭐⭐⭐ | +| 3.advanced.multi_devices | Demonstrates how to use multiple devices.| ⭐⭐⭐ | +| 3.advanced.point_cloud | Demonstrates how to save the point cloud to disk using a point cloud filter.| ⭐⭐⭐ | +| 3.advanced.post_processing | Demonstrates how to use post-processing filters.| ⭐⭐⭐ | + + diff --git a/image/compile-1.png b/image/compile-1.png new file mode 100644 index 0000000..e3957eb Binary files /dev/null and b/image/compile-1.png differ diff --git a/image/compile-2.png b/image/compile-2.png new file mode 100644 index 0000000..2542e42 Binary files /dev/null and b/image/compile-2.png differ diff --git a/image/compile-3.png b/image/compile-3.png new file mode 100644 index 0000000..1ae4221 Binary files /dev/null and b/image/compile-3.png differ diff --git a/image/compile-4.png b/image/compile-4.png new file mode 100644 index 0000000..1d122e7 Binary files /dev/null and b/image/compile-4.png differ diff --git a/image/compile-5.png b/image/compile-5.png new file mode 100644 index 0000000..c440fd9 Binary files /dev/null and b/image/compile-5.png differ diff --git a/image/compile-6.png b/image/compile-6.png new file mode 100644 index 0000000..687de65 Binary files /dev/null and b/image/compile-6.png differ diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 deleted file mode 100644 index 04274e6..0000000 --- a/scripts/Build.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -# Build Scripts -$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path -$projectRoot = Split-Path -Parent $scriptDir -$orbbecSdkPath = Join-Path -Path $projectRoot -ChildPath "OrbbecSDK" -$libPath = Join-Path -Path $orbbecSdkPath -ChildPath "lib" -$buildPath = Join-Path -Path $projectRoot -ChildPath "build" -$installPath = Join-Path -Path $buildPath -ChildPath "install/CSharpWrapper" - -if (!(Test-Path $orbbecSdkPath)) { - Write-Host "OrbbecSDK not found!" -ForegroundColor Red - exit 1 -} - -if (!(Test-Path $libPath)) { - Write-Host "lib not found!" -ForegroundColor Red - exit 1 -} - -if (!(Test-Path $buildPath)) { - Write-Host "build not found, create it!" -ForegroundColor Yellow - New-Item -Path $buildPath -ItemType Directory | Out-Null -} - -if (!(Test-Path $installPath)) { - Write-Host "install not found, create it!" -ForegroundColor Yellow - New-Item -Path $installPath -ItemType Directory | Out-Null -} - -Write-Host "Please enter the Visual Studio version to use (e.g., '2019' or '2022'). Default is '2019':" -ForegroundColor Cyan -$userInput = Read-Host "Visual Studio Version" - -if ([string]::IsNullOrWhiteSpace($userInput)) { - $userInput = "2019" -} - -switch ($userInput) { - "2019" { $cmakeGenerator = "Visual Studio 16 2019" } - "2022" { $cmakeGenerator = "Visual Studio 17 2022" } - default { - Write-Host "Invalid input! Please enter '2019' or '2022'." -ForegroundColor Red - exit 1 - } -} -Write-Host "Using CMake Generator: $cmakeGenerator" -ForegroundColor Green - -Write-Host "Running cmake to generate the solution..." -ForegroundColor Yellow -Push-Location $buildPath -try { - cmake .. -G "$cmakeGenerator" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$installPath" - cmake --build . --config Release --target install - if ($LASTEXITCODE -ne 0) { - Write-Host "ERROR: cmake failed to generate the solution!" -ForegroundColor Red - throw "CMake generation failed." - } -} catch { - Write-Host "An error occurred during CMake generation." -ForegroundColor Red - Write-Host "Deleting build directory to clean up..." -ForegroundColor Yellow - Remove-Item -Path $buildPath -Recurse -Force - exit 1 -} finally { - Pop-Location -} - -Write-Host "Compilation completed!" -ForegroundColor Cyan \ No newline at end of file