├── .clang-format ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── 1-sensor-sdk-bug-report.md │ ├── 2-body-tracking-bug-report.md │ ├── 3-code-sample-bug-report.md │ └── 4-feature-request--enhancement-.md ├── pull_request_template.md └── workflows │ └── ubuntu-build.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── CMakeSettings.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── README_K4A.md ├── README_PUBLIC.md ├── StubGenerator.xml.in ├── VersionInfo.cs.in ├── azure-pipelines.yml ├── cmake ├── CaptureFxcDeps.py ├── CopyImportedBinary.cmake ├── DefaultBuildType.cmake ├── DetermineTargetArch.cmake ├── FetchContent.cmake ├── FetchContent │ └── CMakeLists.cmake.in ├── FindEbml.cmake ├── FindOpenCV.cmake ├── FindPython │ └── Support.cmake ├── FindPython3.cmake ├── GitCommands.cmake ├── K4AProjectVersion.cmake ├── MSVCLinkerFlags.cmake ├── ShaderCompiler.cmake ├── SourceLink.cmake ├── ValidateFormat.py ├── k4aCompilerFlags.cmake ├── k4aConfig.cmake.in ├── k4aTest.cmake ├── k4arecordConfig.cmake.in └── toolchains │ ├── arm64-linux-clang.cmake │ ├── arm64-linux-gnu.cmake │ ├── i386-linux-clang.cmake │ ├── i386-linux-gnu.cmake │ ├── x86_64-linux-clang.cmake │ └── x86_64-linux-gnu.cmake ├── docs ├── Access_AKDK_Application_Software_with_Femto_Bolt.pdf ├── building.md ├── dependencies.md ├── depthengine.md ├── logo.png ├── releasing.md ├── standards.md ├── testing.md ├── usage.md └── versioning.md ├── doxygen ├── Doxyfile.in ├── DoxygenLayout.xml ├── PublishDocs.ps1 ├── footer.html ├── header.html ├── index.html ├── mainpage.md └── stylesheet.css ├── examples ├── CMakeLists.txt ├── calibration │ ├── CMakeLists.txt │ ├── main.cpp │ └── readme.md ├── enumerate │ ├── CMakeLists.txt │ ├── main.c │ └── readme.md ├── fastpointcloud │ ├── CMakeLists.txt │ ├── README.md │ └── main.cpp ├── green_screen │ ├── CMakeLists.txt │ ├── MultiDeviceCapturer.h │ ├── README.md │ ├── chessboard.png │ ├── hands.PNG │ ├── main.cpp │ ├── noshadow.png │ ├── shadow.png │ └── transformation.h ├── k4arecord_custom_track │ ├── CMakeLists.txt │ ├── README.md │ └── main.c ├── opencv_compatibility │ ├── CMakeLists.txt │ ├── README.md │ └── main.cpp ├── playback_external_sync │ ├── CMakeLists.txt │ ├── main.c │ └── readme.md ├── streaming │ ├── CMakeLists.txt │ ├── main.c │ └── readme.md ├── transformation │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cpp │ ├── transformation_helpers.cpp │ └── transformation_helpers.h ├── undistort │ ├── CMakeLists.txt │ ├── README.md │ └── main.cpp └── viewer │ ├── CMakeLists.txt │ └── opengl │ ├── CMakeLists.txt │ ├── k4adepthpixelcolorizer.h │ ├── k4aimgui_all.h │ ├── k4apixel.h │ ├── k4astaticimageproperties.h │ ├── main.cpp │ ├── readme.md │ ├── texture.cpp │ ├── texture.h │ ├── viewerutil.h │ ├── viewerwindow.cpp │ └── viewerwindow.h ├── extern ├── CMakeLists.txt ├── azure_c_shared │ └── CMakeLists.txt ├── cjson │ └── CMakeLists.txt ├── glfw │ └── CMakeLists.txt ├── googletest │ └── CMakeLists.txt ├── imgui │ └── CMakeLists.txt ├── libebml │ └── CMakeLists.txt ├── libjpeg-turbo │ └── CMakeLists.txt ├── libmatroska │ ├── CMakeLists.txt │ ├── EbmlConfig.cmake │ └── EbmlConfigVersion.cmake ├── libsoundio │ └── CMakeLists.txt ├── libusb │ ├── CMakeLists.txt │ └── config.h ├── libuvc │ └── CMakeLists.txt ├── libyuv │ └── CMakeLists.txt └── spdlog │ └── CMakeLists.txt ├── include ├── k4a │ ├── k4a.h │ ├── k4a.hpp │ ├── k4atypes.h │ └── k4aversion.h.in ├── k4ainternal │ ├── allocator.h │ ├── calibration.h │ ├── capture.h │ ├── capturesync.h │ ├── color.h │ ├── color_mcu.h │ ├── common.h │ ├── deloader.h │ ├── depth.h │ ├── depth_mcu.h │ ├── dewrapper.h │ ├── dynlib.h │ ├── firmware.h │ ├── global.h │ ├── handle.h │ ├── image.h │ ├── imu.h │ ├── k4aplugin.h │ ├── logging.h │ ├── math.h │ ├── matroska_common.h │ ├── matroska_read.h │ ├── matroska_write.h │ ├── queue.h │ ├── rwlock.h │ ├── tewrapper.h │ ├── transformation.h │ └── usbcommand.h └── k4arecord │ ├── playback.h │ ├── playback.hpp │ ├── record.h │ ├── record.hpp │ └── types.h ├── k4a.props.in ├── kinect-qa.md ├── kinect-viewer.ico ├── microsoft-support.md ├── proposals ├── ARM-support.md └── README.md ├── scripts ├── 99-k4a.rules ├── HmdKit.cs ├── RunTestList.py ├── docker │ ├── Dockerfile │ ├── setup-ubuntu.sh │ └── sources.list ├── install-opencv.ps1 └── verify-windows.ps1 ├── src ├── CMakeLists.txt ├── allocator │ ├── CMakeLists.txt │ └── allocator.c ├── calibration │ ├── CMakeLists.txt │ └── calibration.c ├── capturesync │ ├── CMakeLists.txt │ └── capturesync.c ├── color │ ├── CMakeLists.txt │ ├── color.cpp │ ├── color_priv.h │ ├── ksmetadata.h │ ├── mfcamerareader.cpp │ ├── mfcamerareader.h │ ├── uvc_camerareader.cpp │ └── uvc_camerareader.h ├── color_mcu │ ├── CMakeLists.txt │ ├── color_mcu.c │ └── colorcommands.h ├── csharp │ ├── .editorconfig │ ├── .gitignore │ ├── AzureKinectSensorSDK.ruleset │ ├── Examples │ │ ├── WPF │ │ │ ├── App.config │ │ │ ├── App.xaml │ │ │ ├── App.xaml.cs │ │ │ ├── MainWindow.xaml │ │ │ ├── MainWindow.xaml.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.Examples.WPFViewer.csproj │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ ├── Resources.Designer.cs │ │ │ │ ├── Resources.resx │ │ │ │ ├── Settings.Designer.cs │ │ │ │ └── Settings.settings │ │ │ └── packages.config │ │ └── WinForms │ │ │ ├── App.config │ │ │ ├── Form1.Designer.cs │ │ │ ├── Form1.cs │ │ │ ├── Form1.resx │ │ │ ├── Microsoft.Azure.Kinect.Sensor.Examples.WinForms.csproj │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ │ │ ├── packages.config │ │ │ └── stylecop.json │ ├── Extensions │ │ ├── WPF │ │ │ ├── ImageExtensions.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.WPF.csproj │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── app.config │ │ │ └── packages.config │ │ └── WinForms │ │ │ ├── ImageExtensions.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.WinForms.csproj │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── app.config │ │ │ └── packages.config │ ├── K4a.sln │ ├── Microsoft.Azure.Kinect.Sensor.snk │ ├── SDK │ │ ├── Allocator.cs │ │ ├── AzureKinectMemoryCast.cs │ │ ├── AzureKinectMemoryManager.cs │ │ ├── BGRA.cs │ │ ├── Calibration.cs │ │ ├── CalibrationDeviceType.cs │ │ ├── CalibrationModelType.cs │ │ ├── CameraCalibration.cs │ │ ├── Capture.cs │ │ ├── ColorControlCommand.cs │ │ ├── ColorControlMode.cs │ │ ├── ColorResolution.cs │ │ ├── DepthMode.cs │ │ ├── Device.cs │ │ ├── DeviceConfiguration.cs │ │ ├── Exceptions │ │ │ ├── AzureKinectException.cs │ │ │ ├── AzureKinectOpenDeviceException.cs │ │ │ ├── AzureKinectStartCamerasException.cs │ │ │ └── AzureKinectStartImuException.cs │ │ ├── Extrinsics.cs │ │ ├── FPS.cs │ │ ├── FirmwareBuild.cs │ │ ├── FirmwareSignature.cs │ │ ├── HardwareVersion.cs │ │ ├── Image.cs │ │ ├── ImageFormat.cs │ │ ├── ImuSample.cs │ │ ├── Intrinsics.cs │ │ ├── LargeArrayPool.cs │ │ ├── LogLevel.cs │ │ ├── LogMessage.cs │ │ ├── Logger.cs │ │ ├── Microsoft.Azure.Kinect.Sensor.csproj │ │ ├── Native │ │ │ ├── LoggingTracer.cs │ │ │ ├── NativeMethods.cs │ │ │ └── NativeReferenceAttribute.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Short3.cs │ │ ├── Transformation.cs │ │ ├── TransformationInterpolationType.cs │ │ └── WiredSyncMode.cs │ ├── Tests │ │ ├── FunctionalTests │ │ │ ├── Calibration.cs │ │ │ ├── Device.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.FunctionalTests.csproj │ │ │ └── Properties │ │ │ │ └── AssemblyInfo.cs │ │ ├── StubGenerator.UnitTests │ │ │ ├── Microsoft.Azure.Kinect.Sensor.Test.StubGenerator.UnitTests.csproj │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── StubTests.cs │ │ ├── StubGenerator │ │ │ ├── AzureKinectStubGeneratorException.cs │ │ │ ├── CallCount.cs │ │ │ ├── CodeString.cs │ │ │ ├── Compiler.cs │ │ │ ├── CompilerOptions.cs │ │ │ ├── EnvironmentInfo.cs │ │ │ ├── FunctionImplementation.cs │ │ │ ├── FunctionInfo.cs │ │ │ ├── Hash.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.Test.StubGenerator.csproj │ │ │ ├── ModuleImplementation.cs │ │ │ ├── ModuleInfo.cs │ │ │ ├── NativeFailureException.cs │ │ │ ├── NativeInterface.cs │ │ │ ├── NativeMethods.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── Stub.cpp │ │ │ ├── Stub.h │ │ │ ├── StubImplementation.h │ │ │ └── StubbedModule.cs │ │ └── UnitTests │ │ │ ├── CalibrationFunctionTests.cs │ │ │ ├── CaptureTests.cs │ │ │ ├── DeviceFunctionTests.cs │ │ │ ├── ImageFunctionTests.cs │ │ │ ├── LoggingTests.cs │ │ │ ├── Microsoft.Azure.Kinect.Sensor.UnitTests.csproj │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── StructureTests.cs │ │ │ └── TestCalibration.json │ ├── k4a.props │ └── stylecop.json ├── deloader │ ├── CMakeLists.txt │ └── deloader.cpp ├── depth │ ├── CMakeLists.txt │ └── depth.c ├── depth_mcu │ ├── CMakeLists.txt │ ├── depth_mcu.c │ └── depthcommands.h ├── dewrapper │ ├── CMakeLists.txt │ └── dewrapper.c ├── dynlib │ ├── CMakeLists.txt │ ├── dynlib_linux.c │ └── dynlib_windows.c ├── firmware │ ├── CMakeLists.txt │ └── firmware.c ├── global │ ├── CMakeLists.txt │ └── global.c ├── image │ ├── CMakeLists.txt │ └── image.c ├── imu │ ├── CMakeLists.txt │ └── imu.c ├── logging │ ├── CMakeLists.txt │ └── logging.cpp ├── math │ ├── CMakeLists.txt │ └── math.c ├── orbbec │ ├── .gitignore │ ├── CMakeLists.txt │ ├── dll_main.c │ ├── docs │ │ ├── .gitignore │ │ ├── Access_AKDK_Application_Software_with_Femto_Bolt.pdf │ │ ├── CMakeLists.txt │ │ ├── Doxyfile.in │ │ ├── api_reference_main_page.md │ │ └── resource │ │ │ ├── OrbbecSDKK4AWrapper.png │ │ │ └── orbbec_logo.png │ ├── frame_queue │ │ ├── CMakeLists.txt │ │ └── frame_queue.c │ ├── imu_sync │ │ ├── CMakeLists.txt │ │ └── imusync.c │ ├── include │ │ ├── frame_queue.h │ │ ├── imusync.h │ │ ├── ob_type_helper.hpp │ │ └── obmetadata.h │ ├── ob_k4a_impl.cpp │ ├── ob_type_helper.cpp │ └── record │ │ ├── CMakeLists.txt │ │ ├── internal │ │ ├── CMakeLists.txt │ │ ├── iocallback.cpp │ │ ├── matroska_write.cpp │ │ ├── ob_matroska_read.cpp │ │ └── ob_matroska_read.h │ │ └── sdk │ │ ├── CMakeLists.txt │ │ ├── dll_main.c │ │ ├── playback.cpp │ │ └── record.cpp ├── queue │ ├── CMakeLists.txt │ └── queue.c ├── record │ ├── CMakeLists.txt │ ├── internal │ │ ├── CMakeLists.txt │ │ ├── iocallback.cpp │ │ ├── matroska_read.cpp │ │ └── matroska_write.cpp │ └── sdk │ │ ├── CMakeLists.txt │ │ ├── dll_main.c │ │ ├── playback.cpp │ │ └── record.cpp ├── rwlock │ ├── CMakeLists.txt │ ├── rwlock_linux.c │ └── rwlock_win32.c ├── sdk │ ├── CMakeLists.txt │ ├── dll_main.c │ └── k4a.c ├── tewrapper │ ├── CMakeLists.txt │ └── tewrapper.c ├── transformation │ ├── CMakeLists.txt │ ├── extrinsic_transformation.c │ ├── intrinsic_transformation.c │ ├── mode_specific_calibration.c │ ├── rgbz.c │ └── transformation.c └── usbcommand │ ├── CMakeLists.txt │ ├── usb_cmd_priv.h │ ├── usbcommand.c │ └── usbstreaming.c ├── tests ├── CMakeLists.txt ├── Calibration │ ├── CMakeLists.txt │ └── calibration.cpp ├── CaptureSync │ ├── CMakeLists.txt │ └── capturesync.cpp ├── ColorTests │ ├── CMakeLists.txt │ ├── FunctionalTest │ │ ├── CMakeLists.txt │ │ └── color_ft.cpp │ └── UnitTest │ │ ├── CMakeLists.txt │ │ ├── color_mock_libuvc.cpp │ │ ├── color_mock_libuvc.h │ │ ├── color_mock_mediafoundation.cpp │ │ ├── color_mock_mediafoundation.h │ │ ├── color_mock_windows.cpp │ │ ├── color_mock_windows.def │ │ ├── color_mock_windows.h │ │ └── color_ut.cpp ├── DepthTests │ ├── CMakeLists.txt │ ├── FunctionalTest │ │ ├── CMakeLists.txt │ │ └── depth_ft.cpp │ └── UnitTest │ │ ├── CMakeLists.txt │ │ └── depth_ut.cpp ├── ExternLibraries │ ├── CMakeLists.txt │ └── azure_c_shared │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ └── threading.cpp ├── FirmwareTests │ ├── CMakeLists.txt │ ├── firmware_fw.cpp │ ├── firmware_helper.cpp │ ├── firmware_helper.h │ └── firmware_interrupt_fw.cpp ├── IMUTests │ ├── CMakeLists.txt │ ├── FunctionalTest │ │ ├── CMakeLists.txt │ │ └── imu_ft.cpp │ └── UnitTest │ │ ├── CMakeLists.txt │ │ └── imu_ut.cpp ├── RecordTests │ ├── CMakeLists.txt │ ├── FunctionalTest │ │ ├── CMakeLists.txt │ │ └── k4a_cpp_ft.cpp │ └── UnitTest │ │ ├── CMakeLists.txt │ │ ├── custom_track_ut.cpp │ │ ├── playback_perf.cpp │ │ ├── playback_ut.cpp │ │ ├── record_ut.cpp │ │ ├── sample_recordings.cpp │ │ ├── test_helpers.cpp │ │ └── test_helpers.h ├── TestUtil │ ├── CMakeLists.txt │ ├── Capture.cpp │ ├── Capture.h │ ├── Cli.h │ ├── CliEng.c │ ├── Example.c │ ├── Example.h │ ├── Main.cpp │ ├── Main.h │ ├── UsbCmd.c │ ├── UsbCmd.h │ ├── k4aCmd.c │ └── k4aCmd.h ├── Transformation │ ├── CMakeLists.txt │ └── transformation.cpp ├── UnitTests │ ├── CMakeLists.txt │ ├── allocator_ut │ │ ├── CMakeLists.txt │ │ └── allocator.cpp │ ├── depthmcu_ut │ │ ├── CMakeLists.txt │ │ └── depthmcu_ut.cpp │ ├── dynlib_ut │ │ ├── CMakeLists.txt │ │ ├── dynlib.cpp │ │ └── testdynlib.c │ ├── handle_ut │ │ ├── CMakeLists.txt │ │ ├── handle2_ut.cpp │ │ ├── handle3_ut.c │ │ ├── handle_ut.cpp │ │ └── handle_ut.h │ ├── queue_ut │ │ ├── CMakeLists.txt │ │ └── queue.cpp │ └── utcommon │ │ ├── CMakeLists.txt │ │ ├── inc │ │ ├── ut_calibration_data.h │ │ └── utcommon.h │ │ └── utcommon.cpp ├── Utilities │ ├── CMakeLists.txt │ └── ConnEx │ │ ├── CMakeLists.txt │ │ ├── ConnEx.cpp │ │ └── ConnEx.h ├── example │ ├── CMakeLists.txt │ └── test.cpp ├── executables │ ├── CMakeLists.txt │ └── executables_ft.cpp ├── global │ ├── CMakeLists.txt │ └── global.cpp ├── latency │ ├── CMakeLists.txt │ └── latency_perf.cpp ├── logging │ ├── CMakeLists.txt │ └── logging_ut.cpp ├── multidevice │ ├── CMakeLists.txt │ └── multidevice.cpp ├── projections │ ├── CMakeLists.txt │ └── cpp │ │ ├── CMakeLists.txt │ │ └── cpp_projection_ft.cpp ├── rwlock │ ├── CMakeLists.txt │ └── rwlock.cpp └── throughput │ ├── CMakeLists.txt │ └── throughput_perf.cpp ├── tools ├── CMakeLists.txt ├── deversion │ ├── CMakeLists.txt │ ├── README.md │ └── main.c ├── k4afastcapture_streaming │ ├── CMakeLists.txt │ ├── README.md │ ├── k4afastcapture.cpp │ ├── k4afastcapture.h │ └── main.cpp ├── k4afastcapture_trigger │ ├── CMakeLists.txt │ ├── README.md │ └── trigger.cpp ├── k4arecorder │ ├── CMakeLists.txt │ ├── README.md │ ├── cmdparser.h │ ├── k4arecorder.vcxproj │ ├── main.cpp │ ├── recorder.cpp │ └── recorder.h ├── k4aviewer │ ├── CMakeLists.txt │ ├── README.md │ ├── filesystem17.h │ ├── gpudepthtopointcloudconverter.cpp │ ├── gpudepthtopointcloudconverter.h │ ├── ik4adockcontrol.h │ ├── ik4aimageconverter.h │ ├── ik4aobserver.h │ ├── ik4avisualizationwindow.h │ ├── k4aaudiochanneldatagraph.cpp │ ├── k4aaudiochanneldatagraph.h │ ├── k4aaudiomanager.cpp │ ├── k4aaudiomanager.h │ ├── k4aaudiowindow.cpp │ ├── k4aaudiowindow.h │ ├── k4acolorimageconverter.cpp │ ├── k4acolorimageconverter.h │ ├── k4aconvertingimagesource.h │ ├── k4adatasource.h │ ├── k4adepthimageconverter.h │ ├── k4adepthimageconverterbase.h │ ├── k4adepthpixelcolorizer.h │ ├── k4adevicecorrelator.h │ ├── k4adevicedockcontrol.cpp │ ├── k4adevicedockcontrol.h │ ├── k4afilepicker.cpp │ ├── k4afilepicker.h │ ├── k4aframeratetracker.h │ ├── k4aimageextractor.h │ ├── k4aimgui_all.h │ ├── k4aimguiextensions.cpp │ ├── k4aimguiextensions.h │ ├── k4aimugraph.cpp │ ├── k4aimugraph.h │ ├── k4aimugraphdatagenerator.cpp │ ├── k4aimugraphdatagenerator.h │ ├── k4aimuwindow.cpp │ ├── k4aimuwindow.h │ ├── k4ainfraredimageconverter.h │ ├── k4alogdockcontrol.cpp │ ├── k4alogdockcontrol.h │ ├── k4amicrophone.cpp │ ├── k4amicrophone.h │ ├── k4amicrophonelistener.cpp │ ├── k4amicrophonelistener.h │ ├── k4anonbufferingcapturesource.h │ ├── k4apixel.h │ ├── k4apointcloudrenderer.cpp │ ├── k4apointcloudrenderer.h │ ├── k4apointcloudshaders.h │ ├── k4apointcloudviewcontrol.cpp │ ├── k4apointcloudviewcontrol.h │ ├── k4apointcloudvisualizer.cpp │ ├── k4apointcloudvisualizer.h │ ├── k4apointcloudwindow.cpp │ ├── k4apointcloudwindow.h │ ├── k4apollingthread.h │ ├── k4arecordingdockcontrol.cpp │ ├── k4arecordingdockcontrol.h │ ├── k4aringbuffer.h │ ├── k4asoundio_util.h │ ├── k4asourceselectiondockcontrol.cpp │ ├── k4asourceselectiondockcontrol.h │ ├── k4astaticimageproperties.h │ ├── k4atypeoperators.cpp │ ├── k4atypeoperators.h │ ├── k4avideowindow.cpp │ ├── k4avideowindow.h │ ├── k4aviewer.cpp │ ├── k4aviewer.h │ ├── k4aviewererrormanager.cpp │ ├── k4aviewererrormanager.h │ ├── k4aviewerimage.cpp │ ├── k4aviewerimage.h │ ├── k4aviewerlogmanager.cpp │ ├── k4aviewerlogmanager.h │ ├── k4aviewersettingsmanager.cpp │ ├── k4aviewersettingsmanager.h │ ├── k4aviewerutil.h │ ├── k4awindowdock.cpp │ ├── k4awindowdock.h │ ├── k4awindowmanager.cpp │ ├── k4awindowmanager.h │ ├── k4awindowset.cpp │ ├── k4awindowset.h │ ├── k4awindowsizehelpers.h │ ├── linmath.h │ ├── main.cpp │ ├── openglhelpers.h │ ├── perfcounter.cpp │ ├── perfcounter.h │ └── platform │ │ ├── linux │ │ ├── filesystem17.cpp │ │ └── k4adevicecorrelator.cpp │ │ └── windows │ │ ├── filesystem17.cpp │ │ ├── k4adevicecorrelator.cpp │ │ └── wmain.cpp └── updater │ ├── CMakeLists.txt │ └── main.c └── version.rc.in /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | # Declare files that will always have CRLF line endings on checkout. 4 | *.sln text eol=crlf 5 | *.csproj text eol=crlf 6 | *.vcxproj text eol=crlf 7 | *.vcproj text eol=crlf 8 | *.cmd text eol=crlf 9 | # Declare files that will always have LF line endings on checkout. 10 | *.sh text eol=lf 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1-sensor-sdk-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sensor SDK Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: Bug, Triage Needed 6 | assignees: '' 7 | 8 | --- 9 | 10 | 15 | 16 | **Describe the bug** 17 | 18 | 19 | **To Reproduce** 20 | 25 | 26 | **Expected behavior** 27 | 28 | 29 | **Logs** 30 | 32 | 33 | **Screenshots** 34 | 35 | 36 | **Desktop (please complete the following information):** 37 | - OS with Version: 38 | - SDK Version: 39 | - Firmware version: 40 | 41 | **Additional context** 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/2-body-tracking-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Body Tracking Bug report 3 | about: Create a report to help us improve Body Tracking 4 | title: '' 5 | labels: Bug, Triage Needed, Body Tracking 6 | assignees: '' 7 | 8 | --- 9 | 10 | 15 | 16 | **Describe the bug** 17 | 18 | 19 | **To Reproduce** 20 | 25 | 26 | **Expected behavior** 27 | 28 | 29 | **Logs** 30 | 32 | 33 | **Screenshots** 34 | 35 | 36 | **Desktop (please complete the following information):** 37 | - OS with Version: 38 | - SDK Version: 39 | - Firmware version: 40 | 41 | **Additional context** 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/3-code-sample-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Code Sample Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: Bug, Triage Needed, Code Sample 6 | assignees: '' 7 | 8 | --- 9 | 10 | 15 | 16 | **Describe the bug** 17 | 18 | 19 | **To Reproduce** 20 | 25 | 26 | **Expected behavior** 27 | 28 | 29 | **Logs** 30 | 32 | 33 | **Screenshots** 34 | 35 | 36 | **Desktop (please complete the following information):** 37 | - OS with Version: 38 | - SDK Version: 39 | - Firmware version: 40 | 41 | **Additional context** 42 | 43 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 5 | ## Fixes # 6 | 7 | ### Description of the changes: 8 | - 9 | - 10 | - 11 | 12 | 13 | ### Before submitting a Pull Request: 14 | - [ ] I reviewed [CONTRIBUTING.md](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/develop/CONTRIBUTING.md) 15 | - [ ] I [built my changes](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/develop/docs/building.md) locally 16 | - [ ] I ran the [unit tests](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/develop/docs/testing.md) 17 | - [ ] I ran the [functional tests](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/develop/docs/testing.md) with a device 18 | - [ ] I ran the [performance tests](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/develop/docs/testing.md) with a device 19 | 20 | ### I tested changes on: 21 | - [ ] Windows 22 | - [ ] Linux 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu-build.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ "ob/feature/1.1.x" ] 6 | pull_request: 7 | branches: [ "ob/feature/1.1.x" ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: pull submodule 17 | run: git submodule update 18 | - name: cmake 19 | run: mkdir build && cd build && cmake .. 20 | - name: make 21 | run: cd build && make 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 5 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or 6 | comments. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /StubGenerator.xml.in: -------------------------------------------------------------------------------- 1 | 2 | @CMAKE_CXX_COMPILER@ 3 | @CMAKE_LINKER@ 4 | $ENV{INCLUDE} 5 | $ENV{LIB} 6 | -------------------------------------------------------------------------------- /VersionInfo.cs.in: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Reflection; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | #if DEBUG 14 | [assembly: AssemblyConfiguration("Debug")] 15 | #else 16 | [assembly: AssemblyConfiguration("Release")] 17 | #endif 18 | 19 | [assembly: AssemblyProduct("@K4A_PRODUCTNAME@")] 20 | [assembly: AssemblyCompany("@K4A_COMPANYNAME@")] 21 | [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] 22 | [assembly: AssemblyTrademark("")] 23 | 24 | [assembly: CLSCompliant(true)] 25 | 26 | // This is the shared assembly version file for all of our assemblies. 27 | [assembly: AssemblyVersion("@K4A_VERSION_MAJOR@.@K4A_VERSION_MINOR@.@K4A_VERSION_PATCH@.0")] 28 | [assembly: AssemblyFileVersion("@VERSION_STR@.@K4A_VERSION_REVISION@")] 29 | [assembly: AssemblyInformationalVersion("@VERSION_STR@.@K4A_VERSION_REVISION@")] 30 | -------------------------------------------------------------------------------- /cmake/DefaultBuildType.cmake: -------------------------------------------------------------------------------- 1 | # Set a default build type if none was specified 2 | # Taken from kitware's blog 3 | # https://blog.kitware.com/cmake-and-the-default-build-type/ 4 | # Note: The CMake Windows-MSVC.cmake file, will set the build type to Debug by 5 | # default. So this will only work on builds with clang or gcc 6 | set(default_build_type "RelWithDebInfo") 7 | 8 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 9 | message(STATUS "Setting build type to '${default_build_type}' as none was specified.") 10 | set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE 11 | STRING "Choose the build type") 12 | # Set the possible values of build type for cmake-gui 13 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 14 | "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 15 | endif() -------------------------------------------------------------------------------- /cmake/FetchContent/CMakeLists.cmake.in: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | cmake_minimum_required(VERSION ${CMAKE_VERSION}) 5 | 6 | # We name the project and the target for the ExternalProject_Add() call 7 | # to something that will highlight to the user what we are working on if 8 | # something goes wrong and an error message is produced. 9 | 10 | project(${contentName}-populate NONE) 11 | 12 | include(ExternalProject) 13 | ExternalProject_Add(${contentName}-populate 14 | ${ARG_EXTRA} 15 | SOURCE_DIR "${ARG_SOURCE_DIR}" 16 | BINARY_DIR "${ARG_BINARY_DIR}" 17 | CONFIGURE_COMMAND "" 18 | BUILD_COMMAND "" 19 | INSTALL_COMMAND "" 20 | TEST_COMMAND "" 21 | ) 22 | -------------------------------------------------------------------------------- /cmake/FindEbml.cmake: -------------------------------------------------------------------------------- 1 | # Ebml is already in the project, this forces libmatroska to see it -------------------------------------------------------------------------------- /cmake/FindOpenCV.cmake: -------------------------------------------------------------------------------- 1 | if (OpenCV_FIND_REQUIRED) 2 | set (OpenCV_REQ_FLAG "REQUIRED") 3 | else() 4 | set (OpenCV_REQ_FLAG) 5 | endif() 6 | 7 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 8 | find_package (OpenCV CONFIG PATHS "C:/opencv/build/x64/vc14/lib" ${OpenCV_REQ_FLAG}) 9 | else() 10 | find_package (OpenCV CONFIG ${OpenCV_REQ_FLAG}) 11 | endif () -------------------------------------------------------------------------------- /cmake/MSVCLinkerFlags.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Make sure incremental linking is turned off, for valid pdb <-> exe checksums 5 | 6 | set(INCREMENTAL_REGEX "/INCREMENTAL(:[A-Z0-9]+)?") 7 | 8 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) 9 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO") 10 | 11 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) 12 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO") 13 | 14 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}) 15 | set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") 16 | 17 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG}) 18 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO") 19 | 20 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}) 21 | set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") 22 | 23 | string(REGEX REPLACE "${INCREMENTAL_REGEX}" "" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}) 24 | set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") 25 | -------------------------------------------------------------------------------- /cmake/k4aConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | include(CMakeFindDependencyMacro) 5 | 6 | # Add the targets file 7 | include("${CMAKE_CURRENT_LIST_DIR}/k4aTargets.cmake") -------------------------------------------------------------------------------- /cmake/k4arecordConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | include(CMakeFindDependencyMacro) 5 | 6 | # Add the targets file 7 | include("${CMAKE_CURRENT_LIST_DIR}/k4arecordTargets.cmake") 8 | -------------------------------------------------------------------------------- /cmake/toolchains/arm64-linux-clang.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR arm64) 7 | SET(triple aarch64-linux-gnu) 8 | 9 | # which compilers to use 10 | SET(CMAKE_C_COMPILER "clang-6.0") 11 | SET(CMAKE_C_COMPILER_TARGET ${triple}) 12 | SET(CMAKE_CXX_COMPILER "clang++-6.0") 13 | SET(CMAKE_CXX_COMPILER_TARGET ${triple}) 14 | 15 | # Tell pkgconfig to use aarch64 16 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/aarch64-linux-gnu/pkgconfig") 17 | 18 | # Tell CMake to use qemu to emulate 19 | # Note: This should be automatically done by Ubuntu using binfmt_misc, but that 20 | # seems to be broken on WSL (https://github.com/microsoft/WSL/issues/2620) so 21 | # explicitly setting the emulator for now. 22 | SET(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64-static) 23 | -------------------------------------------------------------------------------- /cmake/toolchains/arm64-linux-gnu.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR arm64) 7 | 8 | # which compilers to use 9 | SET(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) 10 | SET(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) 11 | 12 | # Tell pkgconfig to use arm64 13 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/aarch64-linux-gnu/pkgconfig") 14 | 15 | # Tell CMake to use qemu to emulate 16 | # Note: This should be automatically done by Ubuntu using binfmt_misc, but that 17 | # seems to be broken on WSL (https://github.com/microsoft/WSL/issues/2620) so 18 | # explicitly setting the emulator for now. 19 | SET(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64-static) 20 | -------------------------------------------------------------------------------- /cmake/toolchains/i386-linux-clang.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR i386) 7 | 8 | # which compilers to use 9 | SET(CMAKE_C_COMPILER "clang-6.0") 10 | SET(CMAKE_C_FLAGS -m32) 11 | SET(CMAKE_CXX_COMPILER "clang++-6.0") 12 | SET(CMAKE_CXX_FLAGS -m32) 13 | 14 | # save flags to cache 15 | SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "C Flags" FORCE) 16 | SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "C++ Flags" FORCE) 17 | 18 | # Tell pkgconfig to use i386 19 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/i386-linux-gnu/pkgconfig") 20 | -------------------------------------------------------------------------------- /cmake/toolchains/i386-linux-gnu.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR i386) 7 | 8 | # which compilers to use 9 | SET(CMAKE_C_COMPILER gcc) 10 | SET(CMAKE_C_FLAGS -m32) 11 | SET(CMAKE_CXX_COMPILER g++) 12 | SET(CMAKE_CXX_FLAGS -m32) 13 | 14 | # save flags to cache 15 | SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "C Flags" FORCE) 16 | SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "C++ Flags" FORCE) 17 | 18 | # Tell pkgconfig to use i386 19 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/i386-linux-gnu/pkgconfig") 20 | -------------------------------------------------------------------------------- /cmake/toolchains/x86_64-linux-clang.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR x86_64) 7 | SET(triple x86_64-linux-gnu) 8 | 9 | # which compilers to use 10 | SET(CMAKE_C_COMPILER "clang-6.0") 11 | SET(CMAKE_C_COMPILER_TARGET ${triple}) 12 | SET(CMAKE_CXX_COMPILER "clang++-6.0") 13 | SET(CMAKE_CXX_COMPILER_TARGET ${triple}) 14 | 15 | # save flags to cache 16 | SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "C Flags" FORCE) 17 | SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "C++ Flags" FORCE) 18 | 19 | # Tell pkgconfig to use x86_64 20 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/x86_64-linux-gnu/pkgconfig") 21 | -------------------------------------------------------------------------------- /cmake/toolchains/x86_64-linux-gnu.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # the name of the target OS and arch 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_PROCESSOR x86_64) 7 | 8 | # which compilers to use 9 | SET(CMAKE_C_COMPILER gcc) 10 | SET(CMAKE_C_FLAGS -m64) 11 | SET(CMAKE_CXX_COMPILER g++) 12 | SET(CMAKE_CXX_FLAGS -m64) 13 | 14 | # save flags to cache 15 | SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "C Flags" FORCE) 16 | SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "C++ Flags" FORCE) 17 | 18 | # Tell pkgconfig to use x86_64 19 | SET(ENV{PKG_CONFIG_PATH} "/usr/lib/x86_64-linux-gnu/pkgconfig") 20 | -------------------------------------------------------------------------------- /docs/Access_AKDK_Application_Software_with_Femto_Bolt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/docs/Access_AKDK_Application_Software_with_Femto_Bolt.pdf -------------------------------------------------------------------------------- /docs/dependencies.md: -------------------------------------------------------------------------------- 1 | # External Dependencies 2 | 3 | The Azure Kinect repo consumes external dependencies through compiling from source. 4 | It is preferred to build from source when possible due to the lack of 5 | standard package management on Windows. 6 | 7 | ## Building from Source 8 | 9 | To build from source, the Azure Kinect repo must first download the source. 10 | 11 | The Azure Kinect repo uses git submodules to download the source. These submodules are 12 | initialized on the first CMake configure by executing 13 | 14 | ``` 15 | git submodule update --init --recursive 16 | ``` 17 | 18 | CMake will also set the submodules.recurse configuration so that all git 19 | commands which can recurse to submodules will in the future. Users can turn 20 | this off if they would like but do so at their own risk. 21 | 22 | Previously, CMake's FetchContent module was used to download external 23 | dependencies but there was a large performance hit on reconfiguration which 24 | forced the usage of git submodules. 25 | 26 | All the submodules are cloned into ./extern/project_name/src. A 27 | CMakeLists.txt exists in ./extern/project_name which contains the logic 28 | to add the project as a target to the Azure Kinect build graph. 29 | 30 | ## Linking against pre-built binaries 31 | 32 | In order to link against pre-built binaries, those binaries must exist on 33 | disk. Use of a package manager is expected for the typical case of getting 34 | these binaries. On Windows, CMake's FetchContent can be used. 35 | 36 | Once the binaries are downloaded it is up to the programmer to properly 37 | generate a CMake target for the library (if the package doesn't include one 38 | already) 39 | -------------------------------------------------------------------------------- /docs/depthengine.md: -------------------------------------------------------------------------------- 1 | # Depth Engine 2 | 3 | The Azure Kinect Sensor SDK open source project does not include the depth engine which 4 | converts raw sensor data in to a normalized depth map. 5 | 6 | The depth engine is specific to the sensor in the Azure Kinect DK hardware. 7 | 8 | The depth engine is not licensed under MIT as it contains proprietary code which is why it 9 | can't be included in the Azure Kinect Sensor SDK project directly. 10 | 11 | ## Obtaining the Depth Engine 12 | 13 | The depth engine is distributed as part of all Azure Kinect Sensor SDK binary releases. 14 | If you are building the sensor SDK from source, you will need to obtain a copy from a binary 15 | release to read data from a device. 16 | 17 | ### Windows 18 | 19 | If you have run the windows binary installer (see the Azure Kinect DK public 20 | documentation for details), you can get a copy of the depth engine from 21 | `%Program Files%\Azure Kinect 22 | SDK\sdk\windows-desktop\amd64\release\bin\depthengine__.dll`. 23 | 24 | The depth engine must be in your %PATH% or located next to k4a.dll for the SDK 25 | to decode frames from the Azure Kinect DK. 26 | 27 | ### Linux 28 | 29 | The depth engine binary is part of the `libk4a.` debian package. 30 | If you have installed the `libk4a.` debian package, 31 | libdepthengine will be installed in your library path. If you have not (or can 32 | not) you can extract libdepthengine from the download debian package found 33 | [here](https://packages.microsoft.com/ubuntu/18.04/prod/pool/main/libk/). 34 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/docs/logo.png -------------------------------------------------------------------------------- /docs/versioning.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | This describes the versioning scheme used for the Azure SDK and firmware. 4 | 5 | ## Azure Kinect SDK Versioning 6 | 7 | Azure Kinect uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 8 | 9 | * Increasing the major version indicates a breaking change has been made and a loss of functionality may result. The client application may require updates to use the new version. 10 | * Increasing the minor version indicates new features have been added in a backward compatible way. 11 | * Increasing the patch version (sometimes called iteration version) implies changes have been made to the binary in a backward compatible way. 12 | 13 | More details about release versioning can be found [here](releasing.md) 14 | 15 | ## Firmware Versioning 16 | 17 | The Azure Kinect firmware is composed of 4 different firmware versions. These firmware versions are exposed through 18 | `k4a_hardware_version_t`. Here is a sample of that hardware version: 19 | 20 | ``` 21 | RGB Sensor Version: 1.6.98 22 | Depth Sensor Version:1.6.70 23 | Mic Array Version: 1.6.14 24 | Sensor Config: 5006.27 25 | ``` 26 | 27 | This version can also be simplified as `1.6.098070014` where `098`, `070`, 28 | and `014` are the patch versions of each component version, converted to a 29 | zero-based 3 digit form, and concatenated. 30 | -------------------------------------------------------------------------------- /doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doxygen/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Azure Kinect Sensor SDK Documentation 5 | 7 | 29 | 30 | 31 |

API Documentation

32 | 33 |
34 | For the most recent stable build see master. 35 |
36 |
37 | For the most recent development build see develop. 38 |
39 | 40 |

Branches

41 | 42 |
    43 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /doxygen/mainpage.md: -------------------------------------------------------------------------------- 1 | # Welcome 2 | 3 | This documentation describes the API usage for the Azure Kinect Sensor SDK. 4 | 5 | For details about the Azure Kinect DK hardware and for more information about getting started with development please see https://azure.com/kinect. 6 | 7 | ## API Languages 8 | 9 | The Azure Kinect Sensor SDK is primarily a C API. This documentation also covers the C++ wrapper. For the most detailed documentation of 10 | API behavior, see the documentation for the C functions that the C++ classes wrap. 11 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(calibration) 5 | add_subdirectory(enumerate) 6 | add_subdirectory(playback_external_sync) 7 | add_subdirectory(k4arecord_custom_track) 8 | add_subdirectory(fastpointcloud) 9 | add_subdirectory(streaming) 10 | add_subdirectory(transformation) 11 | add_subdirectory(undistort) 12 | add_subdirectory(viewer) 13 | 14 | if (OpenCV_REQUIRED) 15 | find_package(OpenCV REQUIRED) 16 | else() 17 | find_package(OpenCV) 18 | endif () 19 | 20 | if (OpenCV_FOUND) 21 | add_subdirectory(green_screen) 22 | add_subdirectory(opencv_compatibility) 23 | 24 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 25 | file(COPY ${OpenCV_DIR}/../bin/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} FILES_MATCHING PATTERN "*.dll") 26 | endif () 27 | endif () 28 | 29 | install(TARGETS streaming_samples transformation_example viewer_opengl calibration_info fastpointcloud 30 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 31 | COMPONENT samples 32 | ) -------------------------------------------------------------------------------- /examples/calibration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(calibration_info main.cpp) 2 | target_link_libraries(calibration_info PRIVATE k4a::k4a) -------------------------------------------------------------------------------- /examples/calibration/readme.md: -------------------------------------------------------------------------------- 1 | The tool `calibration_info.exe` shows calibration information of all connected 2 | devices. Using `calibration_info.exe` without any command line arguments will 3 | display calibration info of all connected devices in stdout (the mode 4 | `K4A_DEPTH_MODE_NFOV_UNBINNED` is used for depth camera calibration info). If 5 | a device_id is given (0 for default device), the `calibration.json` file of 6 | that device will be saved to the current directory. You can also specify the output file name with another optional parameter. 7 | 8 | Examples: 9 | - `calibration_info.exe` (prints out calibration info for all devices) 10 | - `calibration_info.exe 1` (saves calibration blob for the second enumerated device to `calibration.json`) 11 | - `calibration_info.exe 1 output.txt` (saves calibration blob for the second enumerated device to `output.txt`) 12 | 13 | -------------------------------------------------------------------------------- /examples/enumerate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(enumerate_devices main.c) 5 | target_link_libraries(enumerate_devices PRIVATE k4a::k4a) -------------------------------------------------------------------------------- /examples/enumerate/readme.md: -------------------------------------------------------------------------------- 1 | Enumerate_devices.exe lists all the devices connected to the system and displays each devices serial number. 2 | This sample illustrates how a user would open a device of a specific serial number. 3 | 4 | This tools takes no additional input. -------------------------------------------------------------------------------- /examples/fastpointcloud/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(fastpointcloud 5 | main.cpp) 6 | 7 | target_link_libraries(fastpointcloud PRIVATE 8 | k4a::k4a) -------------------------------------------------------------------------------- /examples/fastpointcloud/README.md: -------------------------------------------------------------------------------- 1 | # Azure Kinect Fastpointcloud Example 2 | 3 | ## Introduction 4 | 5 | The Azure Kinect Fastpointcloud example computes a 3d point cloud from a depth map. The example precomputes a lookup table 6 | by storing x- and y-scale factors for every pixel. At runtime, the 3d X-coordinate of a pixel in millimeters is derived 7 | by multiplying the pixel's depth value with the corresponding x-scale factor. The 3d Y-coordinate is obtained by 8 | multiplying with the y-scale factor. 9 | 10 | This method represents an alternative to calling k4a_transformation_depth_image_to_point_cloud() and lends itself 11 | to efficient implementation on the GPU. 12 | 13 | ## Usage Info 14 | 15 | ``` 16 | fastpointcloud.exe 17 | ``` 18 | 19 | Example: 20 | 21 | ``` 22 | fastpointcloud.exe pointcloud.ply 23 | ``` 24 | -------------------------------------------------------------------------------- /examples/green_screen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | add_executable(green_screen main.cpp) 4 | target_link_libraries(green_screen PRIVATE k4a::k4a ${OpenCV_LIBS}) 5 | -------------------------------------------------------------------------------- /examples/green_screen/chessboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/examples/green_screen/chessboard.png -------------------------------------------------------------------------------- /examples/green_screen/hands.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/examples/green_screen/hands.PNG -------------------------------------------------------------------------------- /examples/green_screen/noshadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/examples/green_screen/noshadow.png -------------------------------------------------------------------------------- /examples/green_screen/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/examples/green_screen/shadow.png -------------------------------------------------------------------------------- /examples/k4arecord_custom_track/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(k4arecord_custom_track main.c) 5 | 6 | target_link_libraries(k4arecord_custom_track PRIVATE 7 | k4a::k4a 8 | k4a::k4arecord 9 | ) 10 | -------------------------------------------------------------------------------- /examples/k4arecord_custom_track/README.md: -------------------------------------------------------------------------------- 1 | # k4arecord Custom Track recording example 2 | 3 | ## Introduction 4 | 5 | The custom track recording example records depth 100 frames from the camera, as well as a custom track 6 | containing a processed version of the depth image. This custom track is playable in video players such as VLC. 7 | 8 | This example also covers adding custom attachments and tags to a recording file. 9 | 10 | ## Usage Info 11 | 12 | ``` 13 | k4arecord_custom_track.exe 14 | ``` 15 | 16 | Example: 17 | 18 | ``` 19 | k4arecord_custom_track.exe custom.mkv 20 | ``` 21 | -------------------------------------------------------------------------------- /examples/opencv_compatibility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(opencv_example main.cpp) 5 | target_link_libraries(opencv_example PRIVATE k4a::k4a ${OpenCV_LIBS}) 6 | -------------------------------------------------------------------------------- /examples/opencv_compatibility/README.md: -------------------------------------------------------------------------------- 1 | # OpenCV compatibility example 2 | 3 | ## Introduction 4 | 5 | The OpenCV compatibility example shows how to convert the Azure Kinect calibration type k4a_calibration_t into the corresponding data 6 | structures of OpenCV. The code demonstrates the use of k4a_calibration_3d_to_2d() to transform five 3D-coordinates of the color 7 | camera into pixel-coordinates of the depth camera. We then show how the same operation is accomplished using the corresponding 8 | OpenCV function projectPoints(). 9 | 10 | If the user has OpenCV installed, the OpenCV-specific code can be enabled by uncommenting the HAVE_OPENCV pound define. The 11 | OpenCV code has been tested using OpenCV 4.1.1. 12 | 13 | ## Usage Info 14 | 15 | opencv_example.exe 16 | 17 | Example: 18 | 19 | opencv_example.exe 20 | -------------------------------------------------------------------------------- /examples/playback_external_sync/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(playback_external_sync main.c) 5 | target_link_libraries(playback_external_sync 6 | k4a::k4a 7 | k4a::k4arecord 8 | ) 9 | -------------------------------------------------------------------------------- /examples/playback_external_sync/readme.md: -------------------------------------------------------------------------------- 1 | # Playback External Sync example 2 | 3 | ## Introduction 4 | 5 | The external sync playback example shows how to open recordings generated from multiple cameras in external sync mode, and access the individual frames from each camera in a synchronized manner. 6 | 7 | ## Usage Info 8 | 9 | playback_external_sync.exe ... 10 | -------------------------------------------------------------------------------- /examples/streaming/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(streaming_samples main.c) 5 | target_link_libraries(streaming_samples PRIVATE k4a::k4a 6 | ) -------------------------------------------------------------------------------- /examples/streaming/readme.md: -------------------------------------------------------------------------------- 1 | This sample illustrates how to use the Azure Kinect API to access both depth and color captures. 2 | 3 | Use on the command line as follows: 4 | 5 | streaming_samples.exe 10 // application will sample 10 color/depth frames 6 | -------------------------------------------------------------------------------- /examples/transformation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(transformation_example 5 | main.cpp 6 | transformation_helpers.cpp 7 | transformation_helpers.h) 8 | 9 | target_link_libraries(transformation_example PRIVATE 10 | k4a::k4a 11 | k4a::k4arecord 12 | libjpeg-turbo::libjpeg-turbo 13 | ) 14 | -------------------------------------------------------------------------------- /examples/transformation/transformation_helpers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | #include 6 | 7 | void tranformation_helpers_write_point_cloud(const k4a_image_t point_cloud_image, 8 | const k4a_image_t color_image, 9 | const char *file_name); 10 | 11 | k4a_image_t downscale_image_2x2_binning(const k4a_image_t color_image); -------------------------------------------------------------------------------- /examples/undistort/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(undistort 5 | main.cpp) 6 | 7 | target_link_libraries(undistort PRIVATE 8 | k4a::k4a) -------------------------------------------------------------------------------- /examples/undistort/README.md: -------------------------------------------------------------------------------- 1 | # Azure Kinect Undistort Example 2 | 3 | ## Introduction 4 | 5 | The undistort example demonstrates how to undistort a depth map. It sets up a virtual pinhole camera with a 120 degree 6 | field of view. The choice of the virtual camera's parameters is arbitrary and can be changed. For every pixel of this 7 | virtual camera, we precompute the corresponding pixel coordinate in the real, distorted depth camera. At runtime, we 8 | use this precomputed lookup table to copy depth values from the distorted depth map to the undistorted depth map using 9 | nearest neighbor interpolation. This remapping function can, for example, also be accomplished using OpenCV's faster 10 | remap() function. 11 | 12 | ## Usage Info 13 | 14 | ``` 15 | undistort.exe 16 | ``` 17 | 18 | Example: 19 | 20 | ``` 21 | undistort.exe undistorted.csv 22 | ``` 23 | -------------------------------------------------------------------------------- /examples/viewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(opengl) 5 | 6 | -------------------------------------------------------------------------------- /examples/viewer/opengl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | find_package(OpenGL REQUIRED) 5 | include_directories( 6 | . 7 | ${OPENGL_INCLUDE_DIRS} 8 | ) 9 | 10 | add_executable(viewer_opengl 11 | main.cpp 12 | texture.cpp 13 | viewerwindow.cpp) 14 | 15 | target_link_libraries(viewer_opengl PRIVATE 16 | k4a::k4a 17 | glfw::glfw 18 | imgui::imgui 19 | ${OPENGL_LIBRARIES}) -------------------------------------------------------------------------------- /examples/viewer/opengl/k4apixel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4APIXEL_H 5 | #define K4APIXEL_H 6 | 7 | // Helper structs/typedefs to cast buffers to 8 | // 9 | namespace viewer 10 | { 11 | 12 | struct BgraPixel 13 | { 14 | uint8_t Blue; 15 | uint8_t Green; 16 | uint8_t Red; 17 | uint8_t Alpha; 18 | }; 19 | 20 | using DepthPixel = uint16_t; 21 | } // namespace viewer 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /examples/viewer/opengl/readme.md: -------------------------------------------------------------------------------- 1 | A no-frills viewer tool that just shows the depth image and color images from the default camera. 2 | 3 | This tools takes no additional input. -------------------------------------------------------------------------------- /extern/azure_c_shared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET aziotsharedutil) 2 | SET(use_http OFF CACHE BOOL "" FORCE) 3 | SET(use_wsio OFF CACHE BOOL "" FORCE) 4 | SET(use_cppunittest OFF CACHE BOOL "" FORCE) 5 | SET(skip_samples ON CACHE BOOL "" FORCE) 6 | 7 | # By default, CMake turns on /W3 for all MSVC builds. 8 | # azure_c_shared_utility's CMakeLists.txt will then append /W4 to the 9 | # CMAKE_CXX_FLAGS and CMAKE_C_FLAGS this causes a warning from cl.exe. To 10 | # prevent this warning, we will remove /W3 from the CMAKE_CXX_FLAGS and 11 | # CMAKE_C_FLAGS before adding the azure_c_shared_utiltiy sub directory 12 | string(REGEX REPLACE " /W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 13 | string(REGEX REPLACE " /W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 14 | 15 | add_subdirectory(src EXCLUDE_FROM_ALL) 16 | 17 | target_include_directories(aziotsharedutil PUBLIC $) 18 | target_include_directories(aziotsharedutil PUBLIC $) 19 | 20 | else() 21 | message(STATUS "aziotsharedutil is already a target. Skipping adding it twice") 22 | endif() 23 | 24 | add_library(azure::aziotsharedutil ALIAS aziotsharedutil) -------------------------------------------------------------------------------- /extern/cjson/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET cJSON) 2 | set(cjson_SOURCE_DIR src) 3 | 4 | add_library(cJSON STATIC 5 | ${cjson_SOURCE_DIR}/cJSON.c 6 | ) 7 | 8 | # prevent cJSON.h from exporting its API's 9 | target_compile_definitions(cJSON PRIVATE -DCJSON_HIDE_SYMBOLS) 10 | 11 | # Consumers should #include 12 | target_include_directories(cJSON PUBLIC 13 | ${cjson_SOURCE_DIR}/) 14 | 15 | # provide a path to cJSON.h which we just moved above 16 | target_include_directories(cJSON PRIVATE 17 | ${cjson_SOURCE_DIR}/cJSON) 18 | 19 | 20 | else() 21 | message(STATUS "cJSON is already a target. Skipping adding it twice") 22 | endif() 23 | 24 | add_library(cJSON::cJSON ALIAS cJSON) -------------------------------------------------------------------------------- /extern/glfw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET glfw) 2 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") 3 | set(CLANG_DISABLE_ALL_WARNINGS "-Wno-everything") 4 | add_compile_options(${CLANG_DISABLE_ALL_WARNINGS}) 5 | endif() 6 | 7 | # Set options for GLFW 8 | option(GLFW_BUILD_EXAMPLES "" OFF) 9 | option(GLFW_BUILD_TESTS "" OFF) 10 | option(GLFW_BUILD_DOCS "" OFF) 11 | option(GLFW_INSTALL "" OFF) 12 | 13 | add_subdirectory(src EXCLUDE_FROM_ALL) 14 | else() 15 | message(STATUS "glfw is already a target. Skipping adding it twice") 16 | endif() 17 | 18 | add_library(glfw::glfw ALIAS glfw) 19 | -------------------------------------------------------------------------------- /extern/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET gtest) 2 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) 3 | option(INSTALL_GTEST "" OFF) 4 | option(INSTALL_GMOCK "" OFF) 5 | add_subdirectory(src EXCLUDE_FROM_ALL) 6 | else() 7 | message(STATUS "gtest is already a target. Skipping adding it twice") 8 | endif() 9 | 10 | add_library(gtest::gtest ALIAS gtest) 11 | add_library(gtest::gmock ALIAS gmock) -------------------------------------------------------------------------------- /extern/imgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET imgui) 2 | set(imguiextern_SOURCE_DIR src) 3 | add_library(imgui STATIC 4 | ${imguiextern_SOURCE_DIR}/imgui.cpp 5 | ${imguiextern_SOURCE_DIR}/imgui_demo.cpp 6 | ${imguiextern_SOURCE_DIR}/imgui_draw.cpp 7 | ${imguiextern_SOURCE_DIR}/imgui_widgets.cpp 8 | ${imguiextern_SOURCE_DIR}/examples/imgui_impl_glfw.cpp 9 | ${imguiextern_SOURCE_DIR}/examples/imgui_impl_opengl3.cpp 10 | ${imguiextern_SOURCE_DIR}/examples/libs/gl3w/GL/gl3w.c 11 | ) 12 | 13 | target_include_directories(imgui PUBLIC 14 | ${imguiextern_SOURCE_DIR} 15 | ${imguiextern_SOURCE_DIR}/examples 16 | ${imguiextern_SOURCE_DIR}/examples/libs/gl3w 17 | ${imguiextern_SOURCE_DIR}/examples/libs/glfw/include 18 | ) 19 | else() 20 | message(STATUS "imgui is already a target. Skipping adding it twice") 21 | endif() 22 | 23 | add_library(imgui::imgui ALIAS imgui) 24 | -------------------------------------------------------------------------------- /extern/libebml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET ebml) 2 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 3 | # Turn off all warnings for MSVC 4 | string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 5 | string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0") 8 | endif() 9 | 10 | add_subdirectory(src EXCLUDE_FROM_ALL) 11 | else() 12 | message(STATUS "ebml is already a target. Skipping adding it twice") 13 | endif() 14 | 15 | add_library(ebml::ebml ALIAS ebml) -------------------------------------------------------------------------------- /extern/libjpeg-turbo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET turbojpeg) 2 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 3 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_WARNINGS") 4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS") 5 | endif() 6 | 7 | set(WITH_CRT_DLL ON CACHE BOOL "Force libjpeg to dynamically link CRT" FORCE) 8 | set(ENABLE_STATIC ON CACHE BOOL "Force libjpeg to enable static lib" FORCE) 9 | 10 | include(CheckLanguage) 11 | check_language(ASM_NASM) 12 | if (CMAKE_ASM_NASM_COMPILER) 13 | enable_language(ASM_NASM) 14 | option(WITH_SIMD "" ON) 15 | else() 16 | message(WARNING "NASM assembler not found - libjpeg-turbo performance may suffer") 17 | option(WITH_SIMD "" OFF) 18 | endif() 19 | 20 | set(CMAKE_INSTALL_DOCDIR ${CMAKE_CURRENT_BINARY_DIR}/install) 21 | 22 | # Stop libjpeg-turbo from overwritting the CMAKE_INSTALL_PREFIX DEFAULT 23 | set(TEMP_CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT}) 24 | set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT NO) 25 | add_subdirectory(src EXCLUDE_FROM_ALL) 26 | set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ${TEMP_CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT}) 27 | 28 | target_include_directories(turbojpeg-static PUBLIC 29 | src 30 | ) 31 | else() 32 | message(STATUS "turbojpeg is already a target. Skipping adding it twice") 33 | endif() 34 | 35 | add_library(libjpeg-turbo::libjpeg-turbo ALIAS turbojpeg-static) 36 | -------------------------------------------------------------------------------- /extern/libmatroska/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET matroska) 2 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 3 | # Turn off all warnings for MSVC 4 | string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 5 | string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0") 8 | endif() 9 | 10 | # This is a hack to trick libmatroska into thinking there is an installed 11 | # version of ebml. In reality, ebml is already a target since its source is 12 | # part of the build graph. 13 | set(Ebml_DIR "${CMAKE_CURRENT_LIST_DIR}") 14 | 15 | add_subdirectory(src EXCLUDE_FROM_ALL) 16 | else() 17 | message(STATUS "matroska is already a target. Skipping adding it twice") 18 | endif() 19 | 20 | add_library(matroska::matroska ALIAS matroska) 21 | -------------------------------------------------------------------------------- /extern/libmatroska/EbmlConfig.cmake: -------------------------------------------------------------------------------- 1 | # This is a hack to trick libmatroska into thinking there is an installed 2 | # version of ebml. In reality, ebml is already a target since its source is 3 | # part of the build graph. -------------------------------------------------------------------------------- /extern/libmatroska/EbmlConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # This is a hack to trick libmatroska into thinking there is an installed 2 | # version of ebml. In reality, ebml is already a target since its source is 3 | # part of the build graph. 4 | 5 | set(PACKAGE_VERSION 1.3.5) 6 | set(PACKAGE_VERSION_EXACT YES) 7 | set(PACKAGE_VERSION_EXACT YES) 8 | -------------------------------------------------------------------------------- /extern/libsoundio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 2 | if (NOT TARGET libsoundio_static) 3 | # Some of the example stuff doesn't build under MSVC 4 | # 5 | set(BUILD_EXAMPLE_PROGRAMS OFF CACHE BOOL "Disable Soundio example projects") 6 | set(BUILD_TESTS OFF CACHE BOOL "Disable Soundio tests") 7 | set(SOUNDIO_STATIC_LIBNAME libsoundio_static) 8 | 9 | add_subdirectory(src EXCLUDE_FROM_ALL) 10 | 11 | target_include_directories(libsoundio_static PUBLIC 12 | src/soundio 13 | ) 14 | 15 | target_compile_definitions(libsoundio_static PUBLIC "SOUNDIO_STATIC_LIBRARY") 16 | 17 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 18 | target_compile_definitions(libsoundio_static PRIVATE "_CRT_SECURE_NO_WARNINGS") 19 | endif() 20 | 21 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") 22 | target_compile_options(libsoundio_static PRIVATE "-Wno-unused-variable") 23 | endif() 24 | 25 | else() 26 | message(STATUS "libsoundio_static is already a target. Skipping adding it twice") 27 | endif() 28 | 29 | add_library(libsoundio::libsoundio ALIAS libsoundio_static) 30 | elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") 31 | find_library(LIBSOUNDIO_LIB soundio) 32 | add_library(libsoundio::libsoundio SHARED IMPORTED GLOBAL) 33 | set_property(TARGET libsoundio::libsoundio PROPERTY IMPORTED_LOCATION ${LIBSOUNDIO_LIB}) 34 | else() 35 | message(FATAL_ERROR "Unknown system name ${CMAKE_SYSTEM_NAME}") 36 | endif() 37 | -------------------------------------------------------------------------------- /extern/libuvc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") 2 | if (NOT TARGET uvc_static) 3 | set(CMAKE_BUILD_TARGET Static) 4 | add_subdirectory(src EXCLUDE_FROM_ALL) 5 | else() 6 | message(STATUS "uvc_static is already a target. Skipping adding it twice") 7 | endif() 8 | 9 | add_library(libuvc::libuvc ALIAS uvc_static) 10 | target_include_directories(uvc_static PUBLIC "$") 11 | target_include_directories(uvc_static PUBLIC "$") 12 | 13 | endif() 14 | 15 | -------------------------------------------------------------------------------- /extern/libyuv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET yuv) 2 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 3 | add_compile_options("/D_CRT_SECURE_NO_WARNINGS") 4 | endif() 5 | 6 | set(CMAKE_IMPORT_LIBRARY_SUFFIX_CACHED ${CMAKE_IMPORT_LIBRARY_SUFFIX}) 7 | unset(CMAKE_IMPORT_LIBRARY_SUFFIX) 8 | add_subdirectory(src EXCLUDE_FROM_ALL) 9 | set(CMAKE_IMPORT_LIBRARY_SUFFIX ${CMAKE_IMPORT_LIBRARY_SUFFIX_CACHED}) 10 | 11 | target_include_directories(yuv PUBLIC 12 | src 13 | src/include 14 | ) 15 | else() 16 | message(STATUS "yuv is already a target. Skipping adding it twice") 17 | endif() 18 | 19 | add_library(libyuv::libyuv ALIAS yuv) 20 | -------------------------------------------------------------------------------- /extern/spdlog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET spdlog) 2 | add_subdirectory(src EXCLUDE_FROM_ALL) 3 | else() 4 | message(STATUS "spdlog is already a target. Skipping adding it twice") 5 | endif() 6 | 7 | add_library(spdlog::spdlog ALIAS spdlog) 8 | -------------------------------------------------------------------------------- /include/k4a/k4aversion.h.in: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Microsoft Corporation. All rights reserved. 2 | Licensed under the MIT License. */ 3 | 4 | #ifndef K4AVERSION_H 5 | #define K4AVERSION_H 6 | 7 | #define K4A_VERSION_MAJOR @K4A_VERSION_MAJOR@ 8 | #define K4A_VERSION_MINOR @K4A_VERSION_MINOR@ 9 | #define K4A_VERSION_PATCH @K4A_VERSION_PATCH@ 10 | #define K4A_VERSION_PRERELEASE "@K4A_VERSION_PRERELEASE@" 11 | #define K4A_VERSION_BUILD_METADATA "@K4A_VERSION_BUILD_METADATA@" 12 | 13 | #define K4A_VERSION_STR "@K4A_VERSION_STR@" 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /include/k4ainternal/rwlock.h: -------------------------------------------------------------------------------- 1 | /** \file rwlock.h 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. 4 | * Kinect For Azure SDK. 5 | */ 6 | 7 | #ifndef RWLOCK_H 8 | #define RWLOCK_H 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifdef _WIN32 17 | typedef void *k4a_rwlock_t; 18 | #else 19 | #include 20 | typedef pthread_rwlock_t k4a_rwlock_t; 21 | #endif 22 | 23 | void rwlock_init(k4a_rwlock_t *lock); 24 | void rwlock_deinit(k4a_rwlock_t *lock); 25 | 26 | void rwlock_acquire_read(k4a_rwlock_t *lock); 27 | bool rwlock_try_acquire_read(k4a_rwlock_t *lock); 28 | 29 | void rwlock_acquire_write(k4a_rwlock_t *lock); 30 | bool rwlock_try_acquire_write(k4a_rwlock_t *lock); 31 | 32 | void rwlock_release_read(k4a_rwlock_t *lock); 33 | void rwlock_release_write(k4a_rwlock_t *lock); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* GLOBAL_H */ 40 | -------------------------------------------------------------------------------- /k4a.props.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | @PROJECT_BINARY_DIR@/src 4 | 5 | 6 | @K4A_BINARY_DIR_DEBUG@ 7 | 8 | 9 | @K4A_BINARY_DIR_RELEASE@ 10 | 11 | -------------------------------------------------------------------------------- /kinect-viewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/kinect-viewer.ico -------------------------------------------------------------------------------- /proposals/README.md: -------------------------------------------------------------------------------- 1 | # Azure Kinect Sensor SDK Proposals 2 | 3 | New features proposals are living documents describing the current thinking about a given feature. Proposals are the way for Azure Kinect team to communicate to the public upcoming new feature work and get the feedback. 4 | At this time, all proposals will be created by Microsoft Azure Kinect team for the most desired features. 5 | If you have a great idea for a proposal, please submit it on [User Voice](https://feedback.azure.com/forums/920053). See more details about contributing to this project or new ideas in our [contribution guide](https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/develop/CONTRIBUTING.md). 6 | We would love your feedback on every proposal and therefore we will create a GitHub issue where you can provide it. The proposal will be available for review for 2 weeks before we will start the work. 7 | -------------------------------------------------------------------------------- /scripts/99-k4a.rules: -------------------------------------------------------------------------------- 1 | # Bus 002 Device 116: ID 045e:097a Microsoft Corp. - Generic Superspeed USB Hub 2 | # Bus 001 Device 015: ID 045e:097b Microsoft Corp. - Generic USB Hub 3 | # Bus 002 Device 118: ID 045e:097c Microsoft Corp. - Azure Kinect Depth Camera 4 | # Bus 002 Device 117: ID 045e:097d Microsoft Corp. - Azure Kinect 4K Camera 5 | # Bus 001 Device 016: ID 045e:097e Microsoft Corp. - Azure Kinect Microphone Array 6 | 7 | BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="k4a_logic_rules_end" 8 | 9 | ATTRS{idVendor}=="045e", ATTRS{idProduct}=="097a", MODE="0666", GROUP="plugdev" 10 | ATTRS{idVendor}=="045e", ATTRS{idProduct}=="097b", MODE="0666", GROUP="plugdev" 11 | ATTRS{idVendor}=="045e", ATTRS{idProduct}=="097c", MODE="0666", GROUP="plugdev" 12 | ATTRS{idVendor}=="045e", ATTRS{idProduct}=="097d", MODE="0666", GROUP="plugdev" 13 | ATTRS{idVendor}=="045e", ATTRS{idProduct}=="097e", MODE="0666", GROUP="plugdev" 14 | 15 | LABEL="k4a_logic_rules_end" 16 | -------------------------------------------------------------------------------- /scripts/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG UBUNTU_VERSION=18.04 2 | # Use the official ubuntu:18.04 image as the parent image 3 | FROM ubuntu:${UBUNTU_VERSION} 4 | 5 | # Set the working directory to /app 6 | WORKDIR /app 7 | 8 | ARG ARCH=amd64 9 | 10 | ADD setup-ubuntu.sh /app 11 | ADD sources.list /app 12 | 13 | # Tell Ubuntu non-interactive install 14 | ARG DEBIAN_FRONTEND=noninteractive 15 | 16 | 17 | RUN ./setup-ubuntu.sh ${ARCH} 18 | 19 | RUN apt-get install -y ca-certificates 20 | RUN update-ca-certificates -------------------------------------------------------------------------------- /scripts/docker/sources.list: -------------------------------------------------------------------------------- 1 | 2 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main restricted 3 | deb [arch=arm64] http://ports.ubuntu.com/ bionic main restricted 4 | 5 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted 6 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates main restricted 7 | 8 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic universe 9 | deb [arch=arm64] http://ports.ubuntu.com/ bionic universe 10 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates universe 11 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates universe 12 | 13 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic multiverse 14 | deb [arch=arm64] http://ports.ubuntu.com/ bionic multiverse 15 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse 16 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates multiverse 17 | 18 | deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 19 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse 20 | 21 | deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security main restricted 22 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-security main restricted 23 | deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security universe 24 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-security universe 25 | deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security multiverse 26 | deb [arch=arm64] http://ports.ubuntu.com/ bionic-security multiverse -------------------------------------------------------------------------------- /src/allocator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_allocator STATIC 5 | allocator.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_allocator PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_allocator PUBLIC 14 | azure::aziotsharedutil 15 | k4ainternal::logging) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::allocator ALIAS k4a_allocator) -------------------------------------------------------------------------------- /src/calibration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_calibration STATIC 5 | calibration.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_calibration PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_calibration PUBLIC 14 | cJSON::cJSON 15 | k4ainternal::logging) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::calibration ALIAS k4a_calibration) -------------------------------------------------------------------------------- /src/capturesync/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_capturesync STATIC 5 | capturesync.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_capturesync PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_capturesync PUBLIC 14 | azure::aziotsharedutil 15 | k4ainternal::logging) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::capturesync ALIAS k4a_capturesync) -------------------------------------------------------------------------------- /src/color/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 5 | set(K4A_COLOR_SYSTEM_SOURCES mfcamerareader.cpp) 6 | set(K4A_COLOR_SYSTEM_DEPENDENCIES 7 | mf.lib 8 | mfplat.lib 9 | mfreadwrite.lib 10 | mfuuid.lib 11 | cfgmgr32.lib) 12 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 13 | set(K4A_COLOR_SYSTEM_SOURCES uvc_camerareader.cpp) 14 | set(K4A_COLOR_SYSTEM_DEPENDENCIES libuvc::libuvc libjpeg-turbo::libjpeg-turbo) 15 | endif() 16 | 17 | add_library(k4a_color STATIC 18 | color.cpp 19 | ${K4A_COLOR_SYSTEM_SOURCES}) 20 | 21 | # Consumers should #include 22 | target_include_directories(k4a_color PUBLIC 23 | ${K4A_PRIV_INCLUDE_DIR}) 24 | 25 | # Dependencies of this library 26 | target_link_libraries(k4a_color PUBLIC 27 | k4ainternal::logging 28 | ${K4A_COLOR_SYSTEM_DEPENDENCIES}) 29 | 30 | # Define alias for other targets to link against 31 | add_library(k4ainternal::color ALIAS k4a_color) 32 | -------------------------------------------------------------------------------- /src/color_mcu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_color_mcu STATIC 5 | color_mcu.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_color_mcu PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_color_mcu PUBLIC 14 | k4ainternal::logging 15 | k4ainternal::usb_cmd) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::color_mcu ALIAS k4a_color_mcu) -------------------------------------------------------------------------------- /src/color_mcu/colorcommands.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /** 5 | * Kinect For Azure SDK. 6 | */ 7 | 8 | #ifndef COLOR_COMMAND_H 9 | #define COLOR_COMMAND_H 10 | 11 | //************************ Includes ***************************** 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | //**************Symbolic Constant Macros (defines) ************* 18 | 19 | //************************ Typedefs ***************************** 20 | #define DEV_CMD_RESET 0x80000000 21 | #define DEV_CMD_SET_SYS_CFG 0x80000001 22 | #define DEV_CMD_GET_SYS_CFG 0x80000002 23 | #define DEV_CMD_IMU_STREAM_START 0x80000003 24 | #define DEV_CMD_IMU_STREAM_STOP 0x80000004 25 | #define DEV_CMD_GET_JACK_STATE 0x80000006 26 | 27 | //************ Declarations (Statics and globals) *************** 28 | 29 | //******************* Function Prototypes *********************** 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* COLOR_COMMAND_H */ 36 | -------------------------------------------------------------------------------- /src/csharp/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore CMake generated files that enable the CSharp solution to find and interact with the CMake built files. 2 | 3 | /k4a.*.props 4 | /StubGenerator.*.xml 5 | 6 | /VersionInfo.cs 7 | 8 | ## Ignore the generated documentation file 9 | /SDK/Microsoft.Azure.Kinect.Sensor.xml 10 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using System.Windows; 4 | 5 | namespace Microsoft.Azure.Kinect.Sensor.Examples.WPFViewer 6 | { 7 | /// 8 | /// Interaction logic for App.xaml 9 | /// 10 | public partial class App : Application 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace K4aWpfTestApplication.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/csharp/Examples/WPF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/Program.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Windows.Forms; 9 | 10 | namespace Microsoft.Azure.Kinect.Sensor.Examples.WinForms 11 | { 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | internal static class Program 16 | { 17 | /// 18 | /// The main entry point for the application. 19 | /// 20 | [STAThread] 21 | internal static void Main() 22 | { 23 | Application.EnableVisualStyles(); 24 | Application.SetCompatibleTextRenderingDefault(false); 25 | 26 | using (Form1 mainWindow = new Form1()) 27 | { 28 | Application.Run(mainWindow); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Reflection; 9 | using System.Runtime.InteropServices; 10 | 11 | // General Information about an assembly is controlled through the following 12 | // set of attributes. Change these attribute values to modify the information 13 | // associated with an assembly. 14 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Examples.WinForms")] 15 | [assembly: AssemblyDescription("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8a14fb66-07cd-4e4c-a533-89de0aff4fcb")] -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Microsoft.Azure.Kinect.Sensor.Examples.WinForms.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/csharp/Examples/WinForms/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | "settings": { 4 | "indentation": { 5 | "useTabs": false 6 | }, 7 | "documentationRules": { 8 | "companyName": "Microsoft Corporation", 9 | "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} License.", 10 | "variables": { 11 | "licenseName": "MIT" 12 | } 13 | }, 14 | "orderingRules": { 15 | "systemUsingDirectivesFirst": true, 16 | "usingDirectivesPlacement": "outsideNamespace" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/csharp/Extensions/WPF/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Reflection; 9 | using System.Runtime.InteropServices; 10 | 11 | // General Information about an assembly is controlled through the following 12 | // set of attributes. Change these attribute values to modify the information 13 | // associated with an assembly. 14 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.WPF")] 15 | [assembly: AssemblyDescription("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4762dd42-3cf3-4742-9aea-5d39781fd2a6")] 24 | -------------------------------------------------------------------------------- /src/csharp/Extensions/WPF/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/csharp/Extensions/WPF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/csharp/Extensions/WinForms/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Reflection; 9 | using System.Runtime.InteropServices; 10 | 11 | // General Information about an assembly is controlled through the following 12 | // set of attributes. Change these attribute values to modify the information 13 | // associated with an assembly. 14 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.WinForms")] 15 | [assembly: AssemblyDescription("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("618e28c5-0624-463f-9adb-040ba5daed68")] 24 | -------------------------------------------------------------------------------- /src/csharp/Extensions/WinForms/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/csharp/Extensions/WinForms/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/csharp/Microsoft.Azure.Kinect.Sensor.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/csharp/Microsoft.Azure.Kinect.Sensor.snk -------------------------------------------------------------------------------- /src/csharp/SDK/ColorControlMode.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Color sensor control mode. 12 | /// 13 | [Native.NativeReference("k4a_color_control_mode_t")] 14 | public enum ColorControlMode 15 | { 16 | /// 17 | /// Set the associated to Auto. 18 | /// 19 | Auto = 0, 20 | 21 | /// 22 | /// Set the associated to Manual. 23 | /// 24 | Manual, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/csharp/SDK/ColorResolution.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Color sensor resolutions. 12 | /// 13 | [Native.NativeReference("k4a_color_resolution_t")] 14 | public enum ColorResolution 15 | { 16 | /// 17 | /// Color camera will be turned off with this setting. 18 | /// 19 | Off = 0, 20 | 21 | /// 22 | /// 1280 * 720 16:9 23 | /// 24 | R720p, 25 | 26 | /// 27 | /// 1920 * 1080 16:9 28 | /// 29 | R1080p, 30 | 31 | /// 32 | /// 2560 * 1440 16:9 33 | /// 34 | R1440p, 35 | 36 | /// 37 | /// 2048 * 1536 4:3 38 | /// 39 | R1536p, 40 | 41 | /// 42 | /// 3840 * 2160 16:9 43 | /// 44 | R2160p, 45 | 46 | /// 47 | /// 4096 * 3072 4:3 48 | /// 49 | R3072p, 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/csharp/SDK/FPS.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Color and depth sensor frame rate. 12 | /// 13 | /// 14 | /// This enumeration is used to select the desired frame rate to operate the cameras. 15 | /// The actual frame rate may vary slightly due to dropped data, synchronization variation 16 | /// between devices, clock accuracy, or if the camera exposure priority mode causes 17 | /// reduced frame rate. 18 | /// 19 | [Native.NativeReference("k4a_fps_t")] 20 | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names 21 | public enum FPS 22 | { 23 | #pragma warning disable CA1712 // Do not prefix enum values with type name 24 | 25 | /// 26 | /// 5 Frames per second. 27 | /// 28 | FPS5 = 0, 29 | 30 | /// 31 | /// 15 Frames per second. 32 | /// 33 | FPS15, 34 | 35 | /// 36 | /// 30 Frames per second. 37 | /// 38 | FPS30, 39 | #pragma warning restore CA1712 // Do not prefix enum values with type name 40 | } 41 | 42 | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names 43 | } 44 | -------------------------------------------------------------------------------- /src/csharp/SDK/FirmwareBuild.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Firmware build type. 12 | /// 13 | [Native.NativeReference("k4a_firmware_build_t")] 14 | public enum FirmwareBuild 15 | { 16 | /// 17 | /// Production firmware. 18 | /// 19 | Release = 0, 20 | 21 | /// 22 | /// Preproduction firmware. 23 | /// 24 | Debug, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/csharp/SDK/FirmwareSignature.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Firmware signature type. 12 | /// 13 | [Native.NativeReference("k4a_firmware_signature_t")] 14 | public enum FirmwareSignature 15 | { 16 | /// 17 | /// Microsoft signed firmware. 18 | /// 19 | Msft, 20 | 21 | /// 22 | /// Test signed firmware. 23 | /// 24 | Test, 25 | 26 | /// 27 | /// Unsigned firmware. 28 | /// 29 | NotSigned, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/csharp/SDK/HardwareVersion.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | 9 | namespace Microsoft.Azure.Kinect.Sensor 10 | { 11 | /// 12 | /// The hardware version information. 13 | /// 14 | public class HardwareVersion 15 | { 16 | /// 17 | /// Gets or sets the color camera firmware version. 18 | /// 19 | public Version RGB { get; set; } 20 | 21 | /// 22 | /// Gets or sets the depth camera firmware version. 23 | /// 24 | public Version Depth { get; set; } 25 | 26 | /// 27 | /// Gets or sets the audio device firmware version. 28 | /// 29 | public Version Audio { get; set; } 30 | 31 | /// 32 | /// Gets or sets the depth sensor firmware version. 33 | /// 34 | public Version DepthSensor { get; set; } 35 | 36 | /// 37 | /// Gets or sets the build type. 38 | /// 39 | public FirmwareBuild FirmwareBuild { get; set; } 40 | 41 | /// 42 | /// Gets or sets the firmware signature. 43 | /// 44 | public FirmwareSignature FirmwareSignature { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/csharp/SDK/ImuSample.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System; 8 | using System.Numerics; 9 | using System.Runtime.InteropServices; 10 | 11 | namespace Microsoft.Azure.Kinect.Sensor 12 | { 13 | /// 14 | /// IMU sample. 15 | /// 16 | [StructLayout(LayoutKind.Sequential)] 17 | [Native.NativeReference("k4a_imu_sample_t")] 18 | public class ImuSample 19 | { 20 | /// 21 | /// Gets or sets temperature reading of this sample (Celsius). 22 | /// 23 | public float Temperature { get; set; } 24 | 25 | /// 26 | /// Gets or sets accelerometer reading of this sample (meters per second squared). 27 | /// 28 | public Vector3 AccelerometerSample { get; set; } 29 | 30 | /// 31 | /// Gets or sets time-stamp of the accelerometer. 32 | /// 33 | public TimeSpan AccelerometerTimestamp { get; set; } 34 | 35 | /// 36 | /// Gets or sets gyroscope sample in radians per second. 37 | /// 38 | public Vector3 GyroSample { get; set; } 39 | 40 | /// 41 | /// Gets or sets time-stamp of the gyroscope. 42 | /// 43 | public TimeSpan GyroTimestamp { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/csharp/SDK/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("28E47B37-B205-4353-92B1-1345C47CD710")] 24 | -------------------------------------------------------------------------------- /src/csharp/SDK/TransformationInterpolationType.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Specifies a type of transformation interpolation. 12 | /// 13 | [Native.NativeReference("k4a_transformation_interpolation_type_t")] 14 | public enum TransformationInterpolationType 15 | { 16 | /// 17 | /// Nearest neighbor interpolation. 18 | /// 19 | [Native.NativeReference("K4A_TRANSFORMATION_INTERPOLATION_TYPE_NEAREST")] 20 | Nearest = 0, 21 | 22 | /// 23 | /// Linear interpolation. 24 | /// 25 | [Native.NativeReference("K4A_TRANSFORMATION_INTERPOLATION_TYPE_LINEAR")] 26 | Linear, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/csharp/SDK/WiredSyncMode.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Microsoft.Azure.Kinect.Sensor 9 | { 10 | /// 11 | /// Synchronization mode when connecting two or more devices together. 12 | /// 13 | [Native.NativeReference("k4a_wired_sync_mode_t")] 14 | public enum WiredSyncMode 15 | { 16 | /// 17 | /// Neither 'Sync In' or 'Sync Out' connections are used. 18 | /// 19 | Standalone, 20 | 21 | /// 22 | /// The 'Sync Out' jack is enabled and synchronization data it driven out the connected wire. 23 | /// 24 | /// 25 | /// While in master mode the color camera must be enabled as part of the multi device sync 26 | /// signaling logic. Even if the color image is not needed, the color camera must be running. 27 | /// 28 | Master, 29 | 30 | /// 31 | /// The 'Sync In' jack is used for synchronization and 'Sync Out' is driven for the next device in the chain. 32 | /// 33 | /// 34 | /// 'Sync Out' is a mirror of 'Sync In' for this mode. 35 | /// 36 | Subordinate, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/csharp/Tests/FunctionalTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.FunctionalTests")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ebf80b3b-83a1-4369-954b-922d8ee5e9cc")] 24 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator.UnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Test.StubGenerator.UnitTests")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("151f9524-9cf0-419d-81b7-cf2d52f90ee5")] 24 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/CallCount.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using System.Collections.Generic; 4 | 5 | namespace Microsoft.Azure.Kinect.Sensor.Test.StubGenerator 6 | { 7 | public class CallCount 8 | { 9 | private readonly StubbedModule module; 10 | 11 | internal CallCount(StubbedModule module) 12 | { 13 | this.module = module; 14 | foreach (FunctionInfo function in module.NativeInterface.Functions) 15 | { 16 | initialCount.Add(function.Name, module.GetTotalCallCount(function.Name)); 17 | } 18 | } 19 | 20 | readonly Dictionary initialCount = new Dictionary(); 21 | 22 | public int Calls(string function) 23 | { 24 | return module.GetTotalCallCount(function) - initialCount[function]; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/FunctionImplementation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using System; 4 | 5 | namespace Microsoft.Azure.Kinect.Sensor.Test.StubGenerator 6 | { 7 | public class FunctionImplementation 8 | { 9 | internal FunctionImplementation(string name, ModuleImplementation module, IntPtr address) 10 | { 11 | this.Name = name; 12 | this.Module = module; 13 | this.Address = address; 14 | } 15 | 16 | // The reference on the ModuleImplementation keeps the module loaded 17 | public ModuleImplementation Module { get; } 18 | 19 | public string Name { get; } 20 | 21 | // Address is not publicly exposed to ensure that references to the function 22 | // keep the ModuleImplementation from being garbage collected, and thus the 23 | // module and function from being unloaded 24 | internal IntPtr Address { get; } 25 | 26 | public override string ToString() 27 | { 28 | return Module.Name + ":" + Name; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/FunctionInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using System.Collections.Generic; 4 | 5 | namespace Microsoft.Azure.Kinect.Sensor.Test.StubGenerator 6 | { 7 | public class FunctionInfo 8 | { 9 | public string Declaration { get; set; } 10 | public string ReturnType { get; set; } 11 | public string Name { get; set; } 12 | public List ArgumentType { get; } = new List(); 13 | public List ArgumentName { get; } = new List(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Test.StubGenerator")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("44795fa0-9b17-40fb-8c8b-f77d754970c8")] 24 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/Stub.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "Stub.h" 5 | #include "StubImplementation.h" 6 | 7 | std::map functionLookup; 8 | std::map callCount; 9 | 10 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 11 | { 12 | switch (ul_reason_for_call) 13 | { 14 | case DLL_PROCESS_ATTACH: 15 | case DLL_THREAD_ATTACH: 16 | case DLL_THREAD_DETACH: 17 | case DLL_PROCESS_DETACH: 18 | break; 19 | } 20 | return TRUE; 21 | } 22 | 23 | extern "C" { 24 | 25 | STUB_EXPORT int Stub_RegisterRedirect(char *functionName, FARPROC implementation) 26 | { 27 | functionLookup[functionName] = implementation; 28 | 29 | return 0; 30 | } 31 | 32 | STUB_EXPORT int Stub_GetCallCount(char *functionName) 33 | { 34 | if (callCount.find(functionName) == callCount.end()) 35 | { 36 | return 0; 37 | } 38 | return callCount[functionName]; 39 | } 40 | 41 | STUB_EXPORT FARPROC Stub_GetFunctionPointer(std::string functionName) 42 | { 43 | std::map::iterator it = functionLookup.find(functionName); 44 | if (it == functionLookup.end() || it->second == NULL) 45 | { 46 | STUB_FAIL("Stubbed function has no implementation"); 47 | } 48 | return it->second; 49 | } 50 | 51 | STUB_EXPORT void Stub_RecordCall(char *functionName) 52 | { 53 | callCount[functionName]++; 54 | } 55 | 56 | } // extern "C" -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/Stub.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 5 | // Windows Header Files 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #ifdef StubExport 13 | #define STUB_EXPORT __declspec(dllexport) 14 | #else 15 | #define STUB_EXPORT __declspec(dllimport) 16 | #endif 17 | 18 | // These functions are exported by the Stub module itself and are callable by either 19 | // The test application or the stub implementations. 20 | extern "C" { 21 | STUB_EXPORT extern FARPROC Stub_GetFunctionPointer(std::string functionName); 22 | STUB_EXPORT extern void Stub_RecordCall(char *szFunction); 23 | } 24 | 25 | template std::function farproc_to_function(FARPROC f) 26 | { 27 | return std::function(reinterpret_cast(f)); 28 | } 29 | 30 | template T redirect(std::string functionName, Arguments... args) 31 | { 32 | auto r = farproc_to_function(Stub_GetFunctionPointer(functionName)); 33 | return r(args...); 34 | } 35 | -------------------------------------------------------------------------------- /src/csharp/Tests/StubGenerator/StubImplementation.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | typedef void(RaiseError)(char *szFile, int line, char *expression); 5 | 6 | RaiseError *g_ErrorHandler = NULL; 7 | 8 | // These functions are exported by the Stub module itself and are callable by either 9 | // The test application or the stub implementations. 10 | extern "C" { 11 | __declspec(dllexport) extern void Stub_SetErrorFunction(RaiseError *pfnErrorHandler); 12 | } 13 | 14 | void Stub_SetErrorFunction(RaiseError *pfnErrorHandler) 15 | { 16 | g_ErrorHandler = pfnErrorHandler; 17 | } 18 | 19 | inline void Stub_Assert(char *szFile, int line, bool expressionValue, char *expression) 20 | { 21 | if (!expressionValue) 22 | { 23 | if (g_ErrorHandler) 24 | { 25 | g_ErrorHandler(szFile, line, expression); 26 | } 27 | else 28 | { 29 | throw 0; 30 | } 31 | } 32 | } 33 | 34 | #define STUB_ASSERT(_expr_) Stub_Assert(__FILE__, __LINE__, (_expr_), #_expr_) 35 | 36 | #define STUB_FAIL(_message_) Stub_Assert(__FILE__, __LINE__, (false), _message_) 37 | -------------------------------------------------------------------------------- /src/csharp/Tests/UnitTests/CalibrationFunctionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using Microsoft.Azure.Kinect.Sensor.Test.StubGenerator; 4 | using NUnit.Framework; 5 | 6 | namespace Microsoft.Azure.Kinect.Sensor.UnitTests 7 | { 8 | public class CalibrationFunctionTests 9 | { 10 | private readonly StubbedModule NativeK4a; 11 | 12 | public CalibrationFunctionTests() 13 | { 14 | NativeK4a = StubbedModule.Get("k4a"); 15 | if (NativeK4a == null) 16 | { 17 | NativeInterface k4ainterface = NativeInterface.Create( 18 | EnvironmentInfo.CalculateFileLocation(@"k4a\k4a.dll"), 19 | EnvironmentInfo.CalculateFileLocation(@"k4a\k4a.h")); 20 | 21 | NativeK4a = StubbedModule.Create("k4a", k4ainterface); 22 | } 23 | } 24 | 25 | [Test] 26 | public void CalibrationGetFromRaw() 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/csharp/Tests/UnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // Licensed under the MIT License. 5 | // 6 | //------------------------------------------------------------------------------ 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.UnitTests")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9a8ec674-aad4-486b-b747-d53989bc8f89")] 24 | -------------------------------------------------------------------------------- /src/csharp/Tests/UnitTests/StructureTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | using NUnit.Framework; 4 | 5 | namespace Microsoft.Azure.Kinect.Sensor.UnitTests 6 | { 7 | public class StructureTests 8 | { 9 | [Test] 10 | public void Short3() 11 | { 12 | Short3 s1 = new Short3(1, 2, 3); 13 | 14 | Assert.AreEqual(1, s1.X); 15 | Assert.AreEqual(2, s1.Y); 16 | Assert.AreEqual(3, s1.Z); 17 | 18 | s1.X = 3; 19 | Assert.AreEqual(3, s1.X); 20 | s1.Y = 4; 21 | Assert.AreEqual(4, s1.Y); 22 | s1.Z = 5; 23 | Assert.AreEqual(5, s1.Z); 24 | 25 | Short3 s2 = new Short3(3, 4, 5); 26 | 27 | Assert.AreEqual(s1, s2); 28 | 29 | Short3 s3 = new Short3(3, 5, 6); 30 | Assert.AreNotEqual(s2, s3); 31 | 32 | } 33 | 34 | [Test] 35 | public void BGRA() 36 | { 37 | BGRA b1 = new BGRA(1, 2, 3, 4); 38 | BGRA b2 = new BGRA(1, 2, 3); 39 | 40 | Assert.AreEqual(1, b1.B); 41 | Assert.AreEqual(2, b1.G); 42 | Assert.AreEqual(3, b1.R); 43 | Assert.AreEqual(4, b1.A); 44 | 45 | Assert.AreEqual(0x04030201, b1.Value); 46 | 47 | Assert.AreNotEqual(b1, b2); 48 | b2.A = 4; 49 | Assert.AreEqual(b1, b2); 50 | 51 | Assert.AreEqual(true, b1.Equals(b2)); 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/csharp/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | "settings": { 4 | "indentation": { 5 | "useTabs": false 6 | }, 7 | "documentationRules": { 8 | "companyName": "Microsoft", 9 | "copyrightText": "Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License." 10 | }, 11 | "orderingRules": { 12 | "systemUsingDirectivesFirst": true, 13 | "usingDirectivesPlacement": "outsideNamespace" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/deloader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_deloader STATIC 5 | deloader.cpp 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_deloader PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | target_link_libraries(k4a_deloader PUBLIC 13 | k4ainternal::allocator 14 | k4ainternal::dynlib 15 | k4ainternal::logging) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::deloader ALIAS k4a_deloader) -------------------------------------------------------------------------------- /src/depth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_depth STATIC 5 | depth.c 6 | ) 7 | 8 | if (K4A_MTE_VERSION) 9 | target_compile_definitions(k4a_depth PRIVATE K4A_MTE_VERSION) 10 | endif () 11 | 12 | # Consumers should #include 13 | target_include_directories(k4a_depth PUBLIC 14 | ${K4A_PRIV_INCLUDE_DIR}) 15 | 16 | # Dependencies of this library 17 | target_link_libraries(k4a_depth PUBLIC 18 | k4ainternal::depth_mcu 19 | k4ainternal::logging) 20 | 21 | 22 | # Define alias for other targets to link against 23 | add_library(k4ainternal::depth ALIAS k4a_depth) -------------------------------------------------------------------------------- /src/depth_mcu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_depth_mcu STATIC 5 | depth_mcu.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_depth_mcu PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_depth_mcu PUBLIC 14 | k4ainternal::image 15 | k4ainternal::logging 16 | k4ainternal::usb_cmd) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::depth_mcu ALIAS k4a_depth_mcu) -------------------------------------------------------------------------------- /src/dewrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_dewrapper STATIC 5 | dewrapper.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_dewrapper PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | target_link_libraries(k4a_dewrapper PUBLIC 13 | azure::aziotsharedutil 14 | k4ainternal::allocator 15 | k4ainternal::calibration 16 | k4ainternal::logging 17 | k4ainternal::queue 18 | k4ainternal::deloader) 19 | 20 | # Define alias for other targets to link against 21 | add_library(k4ainternal::dewrapper ALIAS k4a_dewrapper) -------------------------------------------------------------------------------- /src/dynlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 5 | set(DYNLIB_SRCS dynlib_windows.c) 6 | set(DYNLIB_DEPENDENCIES 7 | pathcch.lib) 8 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 9 | set(DYNLIB_SRCS dynlib_linux.c) 10 | else() 11 | message(FATAL_ERROR "Unknown system: ${CMAKE_SYSTEM_NAME}") 12 | endif() 13 | 14 | add_library(k4a_dynlib STATIC 15 | ${DYNLIB_SRCS} 16 | ) 17 | 18 | # Consumers should #include 19 | target_include_directories(k4a_dynlib PUBLIC ${K4A_PRIV_INCLUDE_DIR}) 20 | 21 | target_link_libraries(k4a_dynlib PUBLIC 22 | k4ainternal::allocator 23 | k4ainternal::logging 24 | ${DYNLIB_DEPENDENCIES}) 25 | 26 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 27 | target_link_libraries(k4a_dynlib PUBLIC dl) 28 | endif() 29 | 30 | # Define alias for other targets to link against 31 | add_library(k4ainternal::dynlib ALIAS k4a_dynlib) 32 | -------------------------------------------------------------------------------- /src/firmware/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_firmware STATIC 5 | firmware.c) 6 | 7 | # Consumers should #include 8 | target_include_directories(k4a_firmware PUBLIC 9 | ${K4A_PRIV_INCLUDE_DIR}) 10 | 11 | # Dependencies of this library 12 | target_link_libraries(k4a_firmware PUBLIC 13 | k4ainternal::color_mcu 14 | k4ainternal::logging) 15 | 16 | # Define alias for other targets to link against 17 | add_library(k4ainternal::firmware ALIAS k4a_firmware) 18 | -------------------------------------------------------------------------------- /src/global/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_global STATIC 5 | global.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_global PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Define alias for other targets to link against 13 | add_library(k4ainternal::global ALIAS k4a_global) 14 | -------------------------------------------------------------------------------- /src/global/global.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // This library 5 | #include 6 | 7 | // System dependencies 8 | 9 | #ifdef _WIN32 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | #include 16 | #ifdef _WIN32 17 | 18 | // TODO: static_assert be available with C11. See Issue #482 19 | // static_assert(sizeof(k4a_init_once_t) == sizeof(INIT_ONCE), 20 | // "Windows INIT_ONCE size doesn't match generic k4a_init_once_t size"); 21 | 22 | static BOOL CALLBACK InitGlobalFunction(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext) 23 | { 24 | UNREFERENCED_PARAMETER(InitOnce); 25 | UNREFERENCED_PARAMETER(lpContext); 26 | 27 | k4a_init_once_function_t *callback = (k4a_init_once_function_t *)Parameter; 28 | 29 | callback(); 30 | 31 | return TRUE; 32 | } 33 | 34 | #else 35 | 36 | // TODO: static_assert be available with C11. See Issue #482 37 | // static_assert(sizeof(k4a_init_once_t) == sizeof(pthread_once_t), 38 | // "Linux pthread_once_t size doesn't match generic k4a_init_once_t size"); 39 | 40 | #endif 41 | 42 | void global_init_once(k4a_init_once_t *init_once, k4a_init_once_function_t *init_function) 43 | { 44 | 45 | #ifdef _WIN32 46 | if (InitOnceExecuteOnce((INIT_ONCE *)init_once, InitGlobalFunction, (void *)init_function, NULL)) 47 | { 48 | return; 49 | } 50 | #else 51 | if (0 == pthread_once((pthread_once_t *)init_once, init_function)) 52 | { 53 | return; 54 | } 55 | #endif 56 | 57 | assert(0); 58 | return; 59 | } 60 | -------------------------------------------------------------------------------- /src/image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_image STATIC 5 | image.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_image PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_image PUBLIC 14 | azure::aziotsharedutil 15 | k4ainternal::allocator 16 | k4ainternal::logging) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::image ALIAS k4a_image) -------------------------------------------------------------------------------- /src/imu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_imu STATIC 5 | imu.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_imu PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_imu PUBLIC 14 | k4ainternal::logging 15 | k4ainternal::usb_cmd 16 | ) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::imu ALIAS k4a_imu) -------------------------------------------------------------------------------- /src/logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_logging STATIC 5 | logging.cpp 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_logging PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_logging PUBLIC 14 | azure::aziotsharedutil 15 | spdlog::spdlog 16 | k4ainternal::rwlock 17 | k4ainternal::global 18 | ) 19 | 20 | # Define alias for other targets to link against 21 | add_library(k4ainternal::logging ALIAS k4a_logging) -------------------------------------------------------------------------------- /src/math/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_math STATIC 5 | math.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_math PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_math PUBLIC 14 | ) 15 | 16 | # Define alias for other targets to link against 17 | add_library(k4ainternal::math ALIAS k4a_math) -------------------------------------------------------------------------------- /src/orbbec/.gitignore: -------------------------------------------------------------------------------- 1 | OrbbecSDK_local -------------------------------------------------------------------------------- /src/orbbec/docs/.gitignore: -------------------------------------------------------------------------------- 1 | Doxyfile -------------------------------------------------------------------------------- /src/orbbec/docs/Access_AKDK_Application_Software_with_Femto_Bolt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/docs/Access_AKDK_Application_Software_with_Femto_Bolt.pdf -------------------------------------------------------------------------------- /src/orbbec/docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Doxygen) 2 | message("Doxygen_FOUND: ${Doxygen_FOUND}") 3 | 4 | if(Doxygen_FOUND) 5 | set(OB_K4A_API_DOC_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc/api/) 6 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc/api/) 7 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) 8 | add_custom_target(ob_k4a_api_doc ALL 9 | COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 10 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 11 | COMMENT "Generating Orbbec SDK K4A Wrapper API Reference documentation with Doxygen" 12 | VERBATIM 13 | ) 14 | endif() -------------------------------------------------------------------------------- /src/orbbec/docs/resource/OrbbecSDKK4AWrapper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/docs/resource/OrbbecSDKK4AWrapper.png -------------------------------------------------------------------------------- /src/orbbec/docs/resource/orbbec_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/docs/resource/orbbec_logo.png -------------------------------------------------------------------------------- /src/orbbec/frame_queue/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_frame_queue STATIC 5 | frame_queue.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_frame_queue PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | target_link_libraries(k4a_frame_queue PUBLIC 13 | azure::aziotsharedutil 14 | k4ainternal::allocator 15 | k4ainternal::logging 16 | ) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::frame_queue ALIAS k4a_frame_queue) -------------------------------------------------------------------------------- /src/orbbec/frame_queue/frame_queue.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/frame_queue/frame_queue.c -------------------------------------------------------------------------------- /src/orbbec/imu_sync/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_imusync STATIC 5 | imusync.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_imusync PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_imusync PUBLIC 14 | azure::aziotsharedutil 15 | k4ainternal::logging) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::imusync ALIAS k4a_imusync) -------------------------------------------------------------------------------- /src/orbbec/include/frame_queue.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/include/frame_queue.h -------------------------------------------------------------------------------- /src/orbbec/include/imusync.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/src/orbbec/include/imusync.h -------------------------------------------------------------------------------- /src/orbbec/record/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(sdk) 5 | add_subdirectory(internal) -------------------------------------------------------------------------------- /src/orbbec/record/internal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Define internal library for testing usage 5 | add_library(k4a_record STATIC 6 | iocallback.cpp 7 | matroska_write.cpp 8 | ) 9 | add_library(k4a_playback STATIC 10 | iocallback.cpp 11 | ob_matroska_read.cpp 12 | ) 13 | 14 | # Consumers should #include 15 | target_include_directories(k4a_record PUBLIC 16 | ${K4A_PRIV_INCLUDE_DIR}) 17 | 18 | # Consumers should #include 19 | target_include_directories(k4a_playback PUBLIC 20 | ${K4A_PRIV_INCLUDE_DIR}) 21 | 22 | target_link_libraries(k4a_record PUBLIC 23 | k4a::k4a 24 | k4ainternal::logging 25 | ebml::ebml 26 | matroska::matroska 27 | ) 28 | 29 | target_link_libraries(k4a_playback PUBLIC 30 | k4a::k4a 31 | k4ainternal::logging 32 | ebml::ebml 33 | matroska::matroska 34 | libyuv::libyuv 35 | libjpeg-turbo::libjpeg-turbo 36 | ) 37 | 38 | # Define alias for other targets to link against 39 | add_library(k4ainternal::record ALIAS k4a_record) 40 | add_library(k4ainternal::playback ALIAS k4a_playback) 41 | -------------------------------------------------------------------------------- /src/queue/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_queue STATIC 5 | queue.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_queue PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | target_link_libraries(k4a_queue PUBLIC 13 | azure::aziotsharedutil 14 | k4ainternal::allocator 15 | k4ainternal::logging 16 | ) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::queue ALIAS k4a_queue) -------------------------------------------------------------------------------- /src/record/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(sdk) 5 | add_subdirectory(internal) 6 | -------------------------------------------------------------------------------- /src/record/internal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Define internal library for testing usage 5 | add_library(k4a_record STATIC 6 | iocallback.cpp 7 | matroska_write.cpp 8 | ) 9 | add_library(k4a_playback STATIC 10 | iocallback.cpp 11 | matroska_read.cpp 12 | ) 13 | 14 | # Consumers should #include 15 | target_include_directories(k4a_record PUBLIC 16 | ${K4A_PRIV_INCLUDE_DIR}) 17 | 18 | # Consumers should #include 19 | target_include_directories(k4a_playback PUBLIC 20 | ${K4A_PRIV_INCLUDE_DIR}) 21 | 22 | target_link_libraries(k4a_record PUBLIC 23 | k4a::k4a 24 | k4ainternal::logging 25 | ebml::ebml 26 | matroska::matroska 27 | ) 28 | 29 | target_link_libraries(k4a_playback PUBLIC 30 | k4a::k4a 31 | k4ainternal::logging 32 | ebml::ebml 33 | matroska::matroska 34 | libyuv::libyuv 35 | libjpeg-turbo::libjpeg-turbo 36 | ) 37 | 38 | # Define alias for other targets to link against 39 | add_library(k4ainternal::record ALIAS k4a_record) 40 | add_library(k4ainternal::playback ALIAS k4a_playback) 41 | -------------------------------------------------------------------------------- /src/rwlock/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") 5 | add_library(k4a_rwlock STATIC 6 | rwlock_linux.c 7 | ) 8 | else() 9 | add_library(k4a_rwlock STATIC 10 | rwlock_win32.c 11 | ) 12 | endif() 13 | 14 | # Consumers should #include 15 | target_include_directories(k4a_rwlock PUBLIC 16 | ${K4A_PRIV_INCLUDE_DIR}) 17 | 18 | # Define alias for other targets to link against 19 | add_library(k4ainternal::rwlock ALIAS k4a_rwlock) 20 | -------------------------------------------------------------------------------- /src/rwlock/rwlock_win32.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // This library 5 | #include 6 | 7 | // System dependencies 8 | #include 9 | #include 10 | 11 | // TODO: static_assert be available with C11. See Issue #482 12 | // static_assert(sizeof(k4a_rwlock_t) == sizeof(SRWLOCK), "Windows SRWLOCK size doesn't match generic k4a_rwlock_t 13 | // size"); 14 | 15 | void rwlock_init(k4a_rwlock_t *lock) 16 | { 17 | InitializeSRWLock((SRWLOCK *)lock); 18 | } 19 | 20 | void rwlock_deinit(k4a_rwlock_t *lock) 21 | { 22 | UNREFERENCED_PARAMETER(lock); 23 | // No work 24 | } 25 | 26 | void rwlock_acquire_read(k4a_rwlock_t *lock) 27 | { 28 | AcquireSRWLockShared((SRWLOCK *)lock); 29 | } 30 | 31 | bool rwlock_try_acquire_read(k4a_rwlock_t *lock) 32 | { 33 | return TryAcquireSRWLockShared((SRWLOCK *)lock); 34 | } 35 | 36 | void rwlock_acquire_write(k4a_rwlock_t *lock) 37 | { 38 | AcquireSRWLockExclusive((SRWLOCK *)lock); 39 | } 40 | 41 | bool rwlock_try_acquire_write(k4a_rwlock_t *lock) 42 | { 43 | return TryAcquireSRWLockExclusive((SRWLOCK *)lock); 44 | } 45 | 46 | void rwlock_release_read(k4a_rwlock_t *lock) 47 | { 48 | ReleaseSRWLockShared((SRWLOCK *)lock); 49 | } 50 | 51 | void rwlock_release_write(k4a_rwlock_t *lock) 52 | { 53 | ReleaseSRWLockExclusive((SRWLOCK *)lock); 54 | } 55 | -------------------------------------------------------------------------------- /src/tewrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_tewrapper STATIC 5 | tewrapper.c 6 | ) 7 | 8 | # Consumers should #include 9 | target_include_directories(k4a_tewrapper PUBLIC 10 | ${K4A_PRIV_INCLUDE_DIR}) 11 | 12 | target_link_libraries(k4a_tewrapper PUBLIC 13 | azure::aziotsharedutil 14 | k4ainternal::logging 15 | k4ainternal::deloader) 16 | 17 | # Define alias for other targets to link against 18 | add_library(k4ainternal::tewrapper ALIAS k4a_tewrapper) -------------------------------------------------------------------------------- /src/transformation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_transformation STATIC 5 | extrinsic_transformation.c 6 | intrinsic_transformation.c 7 | mode_specific_calibration.c 8 | rgbz.c 9 | transformation.c 10 | ) 11 | 12 | # Dependencies of this library 13 | target_link_libraries(k4a_transformation PUBLIC 14 | k4ainternal::math 15 | k4ainternal::deloader 16 | k4ainternal::tewrapper 17 | ) 18 | 19 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") 20 | if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "amd64.*|x86_64.*|AMD64.*|i686.*|i386.*|x86.*") 21 | target_compile_options(k4a_transformation PRIVATE "-msse4.1") 22 | endif() 23 | endif() 24 | 25 | # Define alias for other targets to link against 26 | add_library(k4ainternal::transformation ALIAS k4a_transformation) 27 | -------------------------------------------------------------------------------- /src/usbcommand/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(k4a_usb_cmd STATIC 5 | usbcommand.c 6 | usbstreaming.c 7 | ) 8 | 9 | # Consumers should #include 10 | target_include_directories(k4a_usb_cmd PUBLIC 11 | ${K4A_PRIV_INCLUDE_DIR}) 12 | 13 | # Dependencies of this library 14 | target_link_libraries(k4a_usb_cmd PUBLIC 15 | azure::aziotsharedutil 16 | LibUSB::LibUSB 17 | k4ainternal::allocator 18 | k4ainternal::image 19 | k4ainternal::logging) 20 | 21 | # Define alias for other targets to link against 22 | add_library(k4ainternal::usb_cmd ALIAS k4a_usb_cmd) -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # define the k4a_add_test function which is used for registering tests 5 | include(k4aTest) 6 | 7 | #add_subdirectory(Calibration) 8 | add_subdirectory(CaptureSync) 9 | # add_subdirectory(ColorTests) 10 | #add_subdirectory(DepthTests) 11 | add_subdirectory(executables) 12 | add_subdirectory(ExternLibraries) 13 | #add_subdirectory(FirmwareTests) 14 | add_subdirectory(global) 15 | add_subdirectory(latency) 16 | add_subdirectory(logging) 17 | #add_subdirectory(IMUTests) 18 | add_subdirectory(multidevice) 19 | add_subdirectory(projections) 20 | add_subdirectory(RecordTests) 21 | add_subdirectory(rwlock) 22 | add_subdirectory(example) 23 | add_subdirectory(TestUtil) 24 | add_subdirectory(Transformation) 25 | add_subdirectory(throughput) 26 | add_subdirectory(UnitTests) 27 | add_subdirectory(Utilities) 28 | -------------------------------------------------------------------------------- /tests/Calibration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(calibration_ut calibration.cpp) 5 | 6 | target_link_libraries(calibration_ut PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::calibration 10 | k4ainternal::utcommon) 11 | 12 | k4a_add_tests(TARGET calibration_ut TEST_TYPE UNIT) 13 | -------------------------------------------------------------------------------- /tests/CaptureSync/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(capturesync_ut capturesync.cpp) 5 | 6 | target_link_libraries(capturesync_ut PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::allocator 10 | k4ainternal::capturesync 11 | k4ainternal::image 12 | k4ainternal::queue 13 | k4ainternal::utcommon) 14 | 15 | k4a_add_tests(TARGET capturesync_ut TEST_TYPE UNIT) 16 | -------------------------------------------------------------------------------- /tests/ColorTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | 5 | # define the k4a_add_test function which is used for registering tests 6 | include(k4aTest) 7 | 8 | add_subdirectory(FunctionalTest) 9 | add_subdirectory(UnitTest) 10 | -------------------------------------------------------------------------------- /tests/ColorTests/FunctionalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(color_ft color_ft.cpp) 5 | 6 | target_link_libraries(color_ft PRIVATE 7 | k4a::k4a 8 | k4ainternal::utcommon 9 | gtest::gtest 10 | azure::aziotsharedutil) 11 | 12 | k4a_add_tests(TARGET color_ft HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 13 | -------------------------------------------------------------------------------- /tests/ColorTests/UnitTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # 5 | # Mock shared library 6 | # 7 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 8 | set(COLOR_MOCK_SOURCE color_mock_mediafoundation.cpp) 9 | set(COLOR_SYSTEM_MOCK_SOURCE color_mock_windows.cpp color_mock_windows.def) 10 | 11 | add_library(color_ut_mock SHARED 12 | ${COLOR_SYSTEM_MOCK_SOURCE}) 13 | 14 | target_link_libraries(color_ut_mock PRIVATE 15 | k4ainternal::utcommon) 16 | 17 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 18 | set(COLOR_MOCK_SOURCE color_mock_libuvc.cpp) 19 | endif() 20 | 21 | # 22 | # Color unit test 23 | # 24 | add_executable(color_ut color_ut.cpp ${COLOR_MOCK_SOURCE}) 25 | 26 | target_link_libraries(color_ut PRIVATE 27 | k4ainternal::utcommon 28 | 29 | # Link k4ainternal::color without transitive dependencies 30 | $ 31 | k4ainternal::image 32 | k4ainternal::queue) 33 | 34 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 35 | target_link_libraries(color_ut PRIVATE 36 | color_ut_mock 37 | mf.lib 38 | mfplat.lib 39 | mfreadwrite.lib 40 | mfuuid.lib 41 | cfgmgr32.lib) 42 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 43 | target_link_libraries(color_ut PRIVATE 44 | libuvc::libuvc 45 | libjpeg-turbo::libjpeg-turbo) 46 | endif() 47 | 48 | k4a_add_tests(TARGET color_ut TEST_TYPE UNIT) 49 | -------------------------------------------------------------------------------- /tests/ColorTests/UnitTest/color_mock_mediafoundation.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef COLOR_MOCK_MEDIAFOUNDATION_H 5 | #define COLOR_MOCK_MEDIAFOUNDATION_H 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class MockMediaFoundation 15 | { 16 | public: 17 | MOCK_METHOD3(MFEnumDeviceSources, 18 | HRESULT(IMFAttributes *pAttributes, IMFActivate ***pppSourceActivate, UINT32 *pcSourceActivate)); 19 | MOCK_METHOD3(MFCreateSourceReaderFromMediaSource, 20 | HRESULT(IMFMediaSource *pMediaSource, IMFAttributes *pAttributes, IMFSourceReader **ppSourceReader)); 21 | }; 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | extern MockMediaFoundation *g_mockMediaFoundation; 27 | 28 | void EXPECT_MFEnumDeviceSources(MockMediaFoundation &mockMediaFoundation); 29 | 30 | void EXPECT_MFCreateSourceReaderFromMediaSource(MockMediaFoundation &mockMediaFoundation); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif // COLOR_MOCK_MEDIAFOUNDATION_H 37 | -------------------------------------------------------------------------------- /tests/ColorTests/UnitTest/color_mock_windows.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | SetWindowsSystemMock 3 | CM_Get_Device_Interface_PropertyW 4 | CM_Locate_DevNodeW 5 | CM_Get_DevNode_PropertyW 6 | -------------------------------------------------------------------------------- /tests/DepthTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # define the k4a_add_test function which is used for registering tests 5 | include(k4aTest) 6 | 7 | add_subdirectory(FunctionalTest) 8 | add_subdirectory(UnitTest) 9 | -------------------------------------------------------------------------------- /tests/DepthTests/FunctionalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(depth_ft depth_ft.cpp) 5 | 6 | target_link_libraries(depth_ft PRIVATE 7 | k4a::k4a 8 | k4ainternal::utcommon 9 | gtest::gtest 10 | azure::aziotsharedutil) 11 | 12 | k4a_add_tests(TARGET depth_ft HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 13 | -------------------------------------------------------------------------------- /tests/DepthTests/UnitTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(depth_ut depth_ut.cpp) 5 | 6 | target_link_libraries(depth_ut PRIVATE 7 | k4ainternal::utcommon 8 | 9 | # Link k4ainternal::depth without transitive dependencies 10 | $ 11 | # Link the dependencies of k4ainternal::depth that we do not mock 12 | k4ainternal::calibration 13 | k4ainternal::image 14 | k4ainternal::logging 15 | k4ainternal::queue) 16 | 17 | # Include the PUBLIC and INTERFACE directories specified by k4ainternal::depth 18 | target_include_directories(depth_ut PRIVATE $) 19 | 20 | k4a_add_tests(TARGET depth_ut TEST_TYPE UNIT) 21 | -------------------------------------------------------------------------------- /tests/ExternLibraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(azure_c_shared) -------------------------------------------------------------------------------- /tests/ExternLibraries/azure_c_shared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(azure_c_shared_test 5 | main.cpp 6 | threading.cpp) 7 | 8 | target_link_libraries(azure_c_shared_test PRIVATE 9 | azure::aziotsharedutil 10 | gtest::gtest) 11 | 12 | k4a_add_tests(TARGET azure_c_shared_test TEST_TYPE UNIT) 13 | -------------------------------------------------------------------------------- /tests/ExternLibraries/azure_c_shared/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | ::testing::InitGoogleTest(&argc, argv); 9 | return RUN_ALL_TESTS(); 10 | } 11 | -------------------------------------------------------------------------------- /tests/FirmwareTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Currently the conn_ex_utility is Windows only, so these tests are only valid during a Windows build. 5 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 6 | 7 | add_executable(firmware_fw firmware_helper.cpp firmware_fw.cpp firmware_interrupt_fw.cpp) 8 | 9 | target_compile_definitions(firmware_fw PRIVATE _CRT_SECURE_NO_WARNINGS) 10 | 11 | target_link_libraries(firmware_fw PRIVATE 12 | k4ainternal::utcommon 13 | 14 | k4ainternal::conn_ex_utility 15 | k4ainternal::depth_mcu 16 | k4ainternal::color_mcu 17 | k4ainternal::calibration 18 | k4ainternal::firmware 19 | k4ainternal::logging 20 | k4ainternal::usb_cmd) 21 | 22 | # Include the PUBLIC directories specified by k4ainternal::conn_ex_utility 23 | target_include_directories(firmware_fw PRIVATE $) 24 | 25 | k4a_add_tests(TARGET firmware_fw TEST_TYPE FIRMWARE) 26 | 27 | endif() 28 | -------------------------------------------------------------------------------- /tests/IMUTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # define the k4a_add_test function which is used for registering tests 5 | include(k4aTest) 6 | 7 | add_subdirectory(FunctionalTest) 8 | add_subdirectory(UnitTest) 9 | -------------------------------------------------------------------------------- /tests/IMUTests/FunctionalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(imu_ft imu_ft.cpp) 5 | 6 | target_link_libraries(imu_ft PRIVATE 7 | k4a::k4a 8 | k4ainternal::utcommon 9 | gtest::gtest 10 | azure::aziotsharedutil) 11 | 12 | k4a_add_tests(TARGET imu_ft HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 13 | -------------------------------------------------------------------------------- /tests/IMUTests/UnitTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(imu_ut imu_ut.cpp) 5 | 6 | target_link_libraries(imu_ut PRIVATE 7 | k4ainternal::utcommon 8 | 9 | # Link k4ainternal::imu without transitive dependencies 10 | $ 11 | 12 | # Link the dependencies of k4ainternal::imu that we do not mock 13 | k4ainternal::allocator 14 | k4ainternal::image 15 | k4ainternal::logging 16 | k4ainternal::queue 17 | k4ainternal::math 18 | k4ainternal::calibration 19 | k4ainternal::depth_mcu 20 | k4ainternal::usb_cmd 21 | ) 22 | 23 | # Include the PUBLIC and INTERFACE directories specified by k4ainternal::imu 24 | target_include_directories(imu_ut PRIVATE $) 25 | 26 | k4a_add_tests(TARGET imu_ut TEST_TYPE UNIT) 27 | -------------------------------------------------------------------------------- /tests/RecordTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # define the k4a_add_test function which is used for registering tests 5 | include(k4aTest) 6 | 7 | add_subdirectory(FunctionalTest) 8 | add_subdirectory(UnitTest) 9 | -------------------------------------------------------------------------------- /tests/RecordTests/FunctionalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(k4a_cpp_ft k4a_cpp_ft.cpp) 5 | 6 | target_link_libraries(k4a_cpp_ft PRIVATE 7 | k4ainternal::utcommon 8 | k4a::k4arecord 9 | ) 10 | 11 | k4a_add_tests(TARGET k4a_cpp_ft TEST_TYPE FUNCTIONAL) 12 | -------------------------------------------------------------------------------- /tests/TestUtil/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | set (TARGET testutil) 5 | 6 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 7 | set(K4A_COLOR_SYSTEM_DIRECTORIES ${PROJECT_SOURCE_DIR}/src/color/) 8 | set(K4A_COLOR_SYSTEM_SOURCES ${K4A_COLOR_SYSTEM_DIRECTORIES}mfcamerareader.cpp) 9 | set(K4A_COLOR_SYSTEM_DEPENDENCIES 10 | mf.lib 11 | mfplat.lib 12 | mfreadwrite.lib 13 | mfuuid.lib 14 | cfgmgr32.lib) 15 | endif() 16 | 17 | set (SRCS 18 | "${CMAKE_CURRENT_SOURCE_DIR}/Capture.cpp" 19 | "${CMAKE_CURRENT_SOURCE_DIR}/CliEng.c" 20 | "${CMAKE_CURRENT_SOURCE_DIR}/Example.c" 21 | "${CMAKE_CURRENT_SOURCE_DIR}/k4aCmd.c" 22 | "${CMAKE_CURRENT_SOURCE_DIR}/Main.cpp" 23 | "${CMAKE_CURRENT_SOURCE_DIR}/UsbCmd.c" 24 | ${K4A_COLOR_SYSTEM_SOURCES} 25 | ) 26 | 27 | set (LIBS 28 | k4a::k4a 29 | k4ainternal::allocator 30 | k4ainternal::image 31 | k4ainternal::logging 32 | k4ainternal::usb_cmd 33 | ${K4A_COLOR_SYSTEM_DEPENDENCIES} 34 | ) 35 | 36 | add_executable(${TARGET} ${SRCS}) 37 | 38 | target_include_directories(${TARGET} PRIVATE ${K4A_COLOR_SYSTEM_DIRECTORIES}) 39 | target_link_libraries(${TARGET} PRIVATE ${LIBS}) 40 | -------------------------------------------------------------------------------- /tests/TestUtil/Capture.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | //************************ Includes ***************************** 7 | 8 | //**************Symbolic Constant Macros (defines) ************* 9 | 10 | //************************ Typedefs ***************************** 11 | 12 | //************ Declarations (Statics and globals) *************** 13 | 14 | //******************* Function Prototypes *********************** 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | void capture_init(void); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /tests/TestUtil/Cli.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | /*----------- Nested includes ------------*/ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | /*-- Symbolic Constant Macros (defines) --*/ 13 | #define MAX_ARGS 64 14 | #define MAX_LINE_LENGTH 128 15 | #define CLI_MAIN_MENU "" 16 | 17 | /*-------------- Typedefs ----------------*/ 18 | typedef enum _CLI_STATUS 19 | { 20 | CLI_SUCCESS, 21 | CLI_ERROR 22 | } CLI_STATUS; 23 | 24 | typedef struct _CLI_COMMAND_T 25 | { 26 | char *Menu; 27 | const char *Command; 28 | CLI_STATUS (*Routine)(int argc, char **argv); 29 | const char *Description; 30 | const char *Usage; 31 | } CLI_COMMAND_T; 32 | 33 | /*-- Declarations (Statics and globals) --*/ 34 | 35 | /*--------- Function Prototypes ----------*/ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | int CliExecute(int Argc, char **Argv); 41 | void CliRegister(char *pMenu, 42 | const char *pSyntax, 43 | CLI_STATUS (*Routine)(int argc, char **argv), 44 | const char *pDescription, 45 | const char *pUsage); 46 | void CliRegisterTable(CLI_COMMAND_T *pTable); 47 | bool CliGetStrVal(const char *str, uint32_t *pOut); 48 | uint8_t CliGetBin(char *pSrc, uint8_t *pDst, uint32_t Size); 49 | uint16_t CliRead(char *pPrompt, char *pString, uint8_t Length); 50 | void CliDisplayUsage(CLI_STATUS (*Routine)(int argc, char **argv)); 51 | uint32_t CliGetChar(char *Ch); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /tests/TestUtil/Example.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //************************ Includes ***************************** 5 | #include 6 | #include "Cli.h" 7 | #include "Example.h" 8 | 9 | //**************Symbolic Constant Macros (defines) ************* 10 | 11 | //************************ Typedefs ***************************** 12 | 13 | //************ Declarations (Statics and globals) *************** 14 | 15 | //******************* Function Prototypes *********************** 16 | 17 | //*********************** Functions ***************************** 18 | 19 | /** 20 | * Example command for displaying "bob" from 'example menu. 21 | * 22 | * @param Argc Number of variables handed in 23 | * 24 | * @param Argv Pointer to variable array 25 | * 26 | * @return 27 | * CLI_SUCCESS If executed properly 28 | * CLI_ERROR If error was detected 29 | * 30 | */ 31 | static CLI_STATUS ExampleCmdBob(int Argc, char **Argv) 32 | { 33 | (void)Argc; // unused 34 | (void)Argv; // unused 35 | printf("Hello, I'm Bob\n"); 36 | return CLI_SUCCESS; 37 | } 38 | 39 | /** 40 | * Example unit test file 41 | * 42 | */ 43 | void ExampleInit(void) 44 | { 45 | CliRegister("example", "bob", ExampleCmdBob, "Display Bob", "Example for commands on main menu\nExample: bob"); 46 | } 47 | -------------------------------------------------------------------------------- /tests/TestUtil/Example.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | //************************ Includes ***************************** 7 | 8 | //**************Symbolic Constant Macros (defines) ************* 9 | 10 | //************************ Typedefs ***************************** 11 | 12 | //************ Declarations (Statics and globals) *************** 13 | 14 | //******************* Function Prototypes *********************** 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | void ExampleInit(void); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /tests/TestUtil/Main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | //************************ Includes ***************************** 7 | 8 | //**************Symbolic Constant Macros (defines) ************* 9 | 10 | //************************ Typedefs ***************************** 11 | 12 | //************ Declarations (Statics and globals) *************** 13 | 14 | //******************* Function Prototypes *********************** 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | k4a_device_t get_k4a_handle(uint32_t index); 19 | void open_k4a(void); 20 | void close_k4a(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /tests/TestUtil/UsbCmd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | //************************ Includes ***************************** 7 | 8 | //**************Symbolic Constant Macros (defines) ************* 9 | 10 | //************************ Typedefs ***************************** 11 | 12 | //************ Declarations (Statics and globals) *************** 13 | 14 | //******************* Function Prototypes *********************** 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | void usb_cmd_init(void); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /tests/TestUtil/k4aCmd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | //************************ Includes ***************************** 7 | 8 | //**************Symbolic Constant Macros (defines) ************* 9 | 10 | //************************ Typedefs ***************************** 11 | 12 | //************ Declarations (Statics and globals) *************** 13 | 14 | //******************* Function Prototypes *********************** 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | void k4a_cmd_init(void); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /tests/Transformation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(transformation_ut transformation.cpp) 5 | 6 | target_link_libraries(transformation_ut PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::image 10 | k4ainternal::transformation 11 | k4ainternal::utcommon 12 | k4a::k4a) 13 | 14 | k4a_add_tests(TARGET transformation_ut TEST_TYPE UNIT) 15 | -------------------------------------------------------------------------------- /tests/UnitTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Unit tests 5 | add_subdirectory(allocator_ut) 6 | add_subdirectory(depthmcu_ut) 7 | add_subdirectory(dynlib_ut) 8 | add_subdirectory(handle_ut) 9 | add_subdirectory(queue_ut) 10 | 11 | # Libraries used by Unit Tests 12 | add_subdirectory(utcommon) 13 | -------------------------------------------------------------------------------- /tests/UnitTests/allocator_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(allocator_ut allocator.cpp) 5 | 6 | target_link_libraries(allocator_ut PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::allocator 10 | k4ainternal::image 11 | k4ainternal::utcommon) 12 | 13 | k4a_add_tests(TARGET allocator_ut TEST_TYPE UNIT) 14 | -------------------------------------------------------------------------------- /tests/UnitTests/depthmcu_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(depthmcu_ut depthmcu_ut.cpp) 5 | 6 | target_link_libraries(depthmcu_ut PRIVATE 7 | k4ainternal::utcommon 8 | 9 | # Link k4ainternal::depth without transitive dependencies 10 | $ 11 | # Link the dependencies of k4ainternal::depth that we do not mock 12 | k4ainternal::allocator 13 | k4ainternal::image 14 | k4ainternal::logging 15 | ) 16 | 17 | # Include the PUBLIC and INTERFACE directories specified by k4ainternal::depth_mcu 18 | target_include_directories(depthmcu_ut PRIVATE $) 19 | 20 | k4a_add_tests(TARGET depthmcu_ut TEST_TYPE UNIT) 21 | -------------------------------------------------------------------------------- /tests/UnitTests/dynlib_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(dynlib_ut dynlib.cpp) 5 | 6 | 7 | set(TEST_LIBRARY_NAME "test_dynlib") 8 | set(TEST_LIBRARY_VERSION 1) 9 | 10 | add_library(${TEST_LIBRARY_NAME} SHARED testdynlib.c) 11 | 12 | include(GenerateExportHeader) 13 | generate_export_header(${TEST_LIBRARY_NAME}) 14 | 15 | target_include_directories(${TEST_LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 16 | 17 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 18 | 19 | set_target_properties( 20 | ${TEST_LIBRARY_NAME} 21 | PROPERTIES 22 | OUTPUT_NAME 23 | "${TEST_LIBRARY_NAME}_${TEST_LIBRARY_VERSION}_0") 24 | 25 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 26 | 27 | set_target_properties( 28 | ${TEST_LIBRARY_NAME} 29 | PROPERTIES 30 | VERSION 31 | "${TEST_LIBRARY_VERSION}.0" 32 | SOVERSION 33 | "${TEST_LIBRARY_VERSION}") 34 | endif() 35 | 36 | target_link_libraries(dynlib_ut PRIVATE 37 | gtest::gtest 38 | k4ainternal::dynlib 39 | k4ainternal::utcommon) 40 | 41 | target_compile_definitions(dynlib_ut PRIVATE TEST_LIBRARY_VERSION=${TEST_LIBRARY_VERSION}) 42 | target_compile_definitions(dynlib_ut PRIVATE TEST_LIBRARY_NAME="${TEST_LIBRARY_NAME}") 43 | 44 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 45 | # Search the same directory as the exectuable for the shared object 46 | target_link_libraries(dynlib_ut PRIVATE "-Wl,-rpath,'$$ORIGIN'") 47 | endif() 48 | 49 | k4a_add_tests(TARGET dynlib_ut TEST_TYPE UNIT) 50 | -------------------------------------------------------------------------------- /tests/UnitTests/dynlib_ut/dynlib.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | 6 | #include 7 | 8 | int main(int argc, char **argv) 9 | { 10 | return k4a_test_common_main(argc, argv); 11 | } 12 | 13 | TEST(dynlib_ut, loadk4a) 14 | { 15 | dynlib_t dynlib_handle = NULL; 16 | 17 | ASSERT_EQ(K4A_RESULT_SUCCEEDED, dynlib_create(TEST_LIBRARY_NAME, TEST_LIBRARY_VERSION, &dynlib_handle)); 18 | 19 | void *address = NULL; 20 | ASSERT_EQ(K4A_BUFFER_RESULT_SUCCEEDED, dynlib_find_symbol(dynlib_handle, "say_hello", &address)); 21 | ASSERT_NE(nullptr, address); 22 | 23 | dynlib_destroy(dynlib_handle); 24 | } 25 | -------------------------------------------------------------------------------- /tests/UnitTests/dynlib_ut/testdynlib.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "test_dynlib_export.h" 5 | 6 | #include 7 | 8 | TEST_DYNLIB_EXPORT void say_hello(void); 9 | 10 | TEST_DYNLIB_EXPORT void say_hello(void) 11 | { 12 | printf("Hello!\n"); 13 | } 14 | -------------------------------------------------------------------------------- /tests/UnitTests/handle_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(handle_ut handle_ut.cpp handle2_ut.cpp handle3_ut.c) 5 | 6 | target_link_libraries(handle_ut PRIVATE 7 | k4ainternal::utcommon 8 | ) 9 | 10 | k4a_add_tests(TARGET handle_ut TEST_TYPE UNIT) 11 | -------------------------------------------------------------------------------- /tests/UnitTests/handle_ut/handle2_ut.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include "handle_ut.h" 6 | 7 | int is_handle_in_2nd_file_valid(dual_defined_t handle) 8 | { 9 | dual_defined_context_t *context = dual_defined_t_get_context(handle); 10 | 11 | return (context != NULL); 12 | } 13 | -------------------------------------------------------------------------------- /tests/UnitTests/handle_ut/handle3_ut.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include "handle_ut.h" 6 | 7 | // K4A_DECLARE_HANDLE(dual_defined_t) is in the header path for this file, so it is created with this C file and in CPP 8 | // files from other source code in this test. They should not be usable 9 | int is_handle_in_c_file_valid(dual_defined_t handle) 10 | { 11 | dual_defined_context_t *context = dual_defined_t_get_context(handle); 12 | 13 | return (context != NULL); 14 | } 15 | -------------------------------------------------------------------------------- /tests/UnitTests/handle_ut/handle_ut.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifdef __cplusplus 5 | #include 6 | #else 7 | #include 8 | #endif 9 | 10 | // Module being tested 11 | #include 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | K4A_DECLARE_HANDLE(dual_defined_t); 18 | 19 | typedef struct 20 | { 21 | int my; 22 | int data; 23 | } dual_defined_context_t; 24 | 25 | // Declare a handle for the context 26 | K4A_DECLARE_CONTEXT(dual_defined_t, dual_defined_context_t); 27 | 28 | // Shared function prototype 29 | int is_handle_in_2nd_file_valid(dual_defined_t handle); 30 | int is_handle_in_c_file_valid(dual_defined_t handle); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /tests/UnitTests/queue_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(queue_ut queue.cpp) 5 | 6 | target_link_libraries(queue_ut PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::allocator 10 | k4ainternal::image 11 | k4ainternal::queue 12 | k4ainternal::utcommon) 13 | 14 | k4a_add_tests(TARGET queue_ut TEST_TYPE UNIT) 15 | -------------------------------------------------------------------------------- /tests/UnitTests/utcommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(utcommon STATIC utcommon.cpp) 5 | 6 | target_link_libraries(utcommon PUBLIC 7 | gtest::gtest 8 | gtest::gmock 9 | k4ainternal::logging 10 | ) 11 | 12 | target_include_directories(utcommon PUBLIC 13 | ${CMAKE_CURRENT_LIST_DIR}/inc) 14 | 15 | # Define alias for other targets to link against 16 | add_library(k4ainternal::utcommon ALIAS utcommon) -------------------------------------------------------------------------------- /tests/UnitTests/utcommon/inc/utcommon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef UTCOMMON_H 5 | #define UTCOMMON_H 6 | 7 | #include 8 | #include "gmock/gmock.h" 9 | 10 | #include 11 | #include 12 | 13 | // Define the output operator for k4a_result_t types for clean test output 14 | std::ostream &operator<<(std::ostream &s, const k4a_result_t &val); 15 | std::ostream &operator<<(std::ostream &s, const k4a_wait_result_t &val); 16 | std::ostream &operator<<(std::ostream &s, const k4a_buffer_result_t &val); 17 | 18 | extern "C" { 19 | 20 | // Generate a Random number between min and max and is inclive of both min and max 21 | #define RAND_VALUE(min, max) (((int64_t)((max) - (min) + 1) * (int64_t)(rand()) / (int64_t)RAND_MAX) + min) 22 | 23 | // Initialize default k4a specific unittest behavior 24 | void k4a_unittest_init(); 25 | void k4a_unittest_deinit(); 26 | 27 | #ifdef _WIN32 28 | void k4a_unittest_init_logging_with_processid(); 29 | #endif 30 | 31 | int k4a_test_common_main(int argc, char **argv); 32 | 33 | int64_t k4a_unittest_get_max_sync_delay_ms(k4a_fps_t fps); 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/Utilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 5 | add_subdirectory(ConnEx) 6 | endif() -------------------------------------------------------------------------------- /tests/Utilities/ConnEx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_library(conn_ex_utility STATIC ConnEx.cpp) 5 | 6 | target_include_directories(conn_ex_utility PUBLIC 7 | ${CMAKE_CURRENT_LIST_DIR}) 8 | 9 | target_link_libraries(conn_ex_utility PRIVATE 10 | k4ainternal::logging) 11 | 12 | # Define alias for other targets to link against 13 | add_library(k4ainternal::conn_ex_utility ALIAS conn_ex_utility) 14 | -------------------------------------------------------------------------------- /tests/Utilities/ConnEx/ConnEx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef CONNECTION_EXERCISER_H 5 | #define CONNECTION_EXERCISER_H 6 | 7 | #include 8 | 9 | // The connection exerciser has 4 active ports plus a everything disconnected "port". 10 | // Port 0 is the disconnected port. Ports 1-4 are the active ports. 11 | #define CONN_EX_MAX_NUM_PORTS 5 12 | 13 | typedef struct connection_exerciser_internal_t *pconnection_exerciser_internal_t; 14 | 15 | class connection_exerciser 16 | { 17 | public: 18 | connection_exerciser(); 19 | ~connection_exerciser(); 20 | 21 | k4a_result_t find_connection_exerciser(); 22 | 23 | k4a_result_t set_usb_port(int port); 24 | 25 | // Returns -1 on failure. 26 | int get_usb_port(); 27 | 28 | // Returns -1 on failure. 29 | float get_voltage_reading(); 30 | 31 | // Returns -1 on failure. 32 | float get_current_reading(); 33 | 34 | private: 35 | k4a_result_t send_command(const char *command, const char *parameter); 36 | k4a_result_t send_command(const char *command, const char *parameter, char *response, size_t size); 37 | template k4a_result_t send_command(const char *command, const char *parameter, char (&response)[size]); 38 | 39 | pconnection_exerciser_internal_t state; 40 | }; 41 | 42 | #endif /* CONNECTION_EXERCISER_H */ 43 | -------------------------------------------------------------------------------- /tests/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(k4a_example_test test.cpp) 5 | target_link_libraries(k4a_example_test PRIVATE k4a::k4a) 6 | target_link_libraries(k4a_example_test PRIVATE gtest::gtest) 7 | 8 | k4a_add_tests(TARGET k4a_example_test HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 9 | -------------------------------------------------------------------------------- /tests/example/test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | 7 | TEST(k4a, example) 8 | { 9 | k4a_device_t device = nullptr; 10 | ASSERT_EQ(K4A_RESULT_SUCCEEDED, k4a_device_open(K4A_DEVICE_DEFAULT, &device)); 11 | k4a_device_close(device); 12 | device = nullptr; 13 | } 14 | 15 | int main(int argc, char **argv) 16 | { 17 | ::testing::InitGoogleTest(&argc, argv); 18 | return RUN_ALL_TESTS(); 19 | } 20 | -------------------------------------------------------------------------------- /tests/executables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | include(k4aTest) 5 | 6 | # Only run green screen tests if OpenCV is installed 7 | find_package(OpenCV) 8 | add_executable(executables_ft executables_ft.cpp) # Single Device Tests 9 | add_executable(executables_ft_custom executables_ft.cpp) # Multi Device Tests 10 | if (OpenCV_FOUND) 11 | target_compile_definitions(executables_ft PRIVATE -DUSE_OPENCV=1 ) 12 | target_compile_definitions(executables_ft_custom PRIVATE -DUSE_OPENCV=1 ) 13 | endif() 14 | target_compile_definitions(executables_ft PRIVATE -DUSE_CUSTOM_TEST_CONFIGURATION=0 ) 15 | target_compile_definitions(executables_ft_custom PRIVATE -DUSE_CUSTOM_TEST_CONFIGURATION=1 ) 16 | 17 | target_link_libraries(executables_ft PRIVATE 18 | k4a::k4a 19 | k4ainternal::utcommon 20 | gtest::gtest) 21 | 22 | target_link_libraries(executables_ft_custom PRIVATE 23 | k4a::k4a 24 | k4ainternal::utcommon 25 | gtest::gtest) 26 | 27 | k4a_add_tests(TARGET executables_ft HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 28 | k4a_add_tests(TARGET executables_ft_custom HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL_CUSTOM) 29 | -------------------------------------------------------------------------------- /tests/global/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(global_ft global.cpp) 5 | 6 | target_link_libraries(global_ft PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::global 10 | k4ainternal::utcommon) 11 | 12 | k4a_add_tests(TARGET global_ft TEST_TYPE FUNCTIONAL) 13 | -------------------------------------------------------------------------------- /tests/latency/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(latency_perf latency_perf.cpp) 5 | 6 | target_compile_definitions(latency_perf PRIVATE _CRT_SECURE_NO_WARNINGS) 7 | 8 | target_link_libraries(latency_perf PRIVATE 9 | azure::aziotsharedutil 10 | gtest::gtest 11 | k4a::k4a 12 | k4ainternal::logging 13 | k4ainternal::utcommon) 14 | 15 | k4a_add_tests(TARGET latency_perf HARDWARE_REQUIRED TEST_TYPE PERF) 16 | -------------------------------------------------------------------------------- /tests/logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(logging_ut logging_ut.cpp) 5 | 6 | target_link_libraries(logging_ut PRIVATE 7 | k4ainternal::utcommon 8 | 9 | # Link k4ainternal::logging without transitive dependencies 10 | $ 11 | # Link the dependencies of k4ainternal::logging that we do not mock 12 | ) 13 | 14 | # Include the PUBLIC and INTERFACE directories specified by k4ainternal::logging 15 | target_include_directories(logging_ut PRIVATE $) 16 | 17 | k4a_add_tests(TARGET logging_ut TEST_TYPE UNIT) 18 | -------------------------------------------------------------------------------- /tests/multidevice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(multidevice_ft multidevice.cpp) 5 | 6 | target_link_libraries(multidevice_ft PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4a::k4a 10 | k4ainternal::utcommon) 11 | 12 | k4a_add_tests(TARGET multidevice_ft TEST_TYPE FUNCTIONAL_CUSTOM) 13 | -------------------------------------------------------------------------------- /tests/projections/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(cpp) 5 | 6 | -------------------------------------------------------------------------------- /tests/projections/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(cpp_projection_ft cpp_projection_ft.cpp) 5 | 6 | target_link_libraries(cpp_projection_ft PRIVATE 7 | k4a::k4a 8 | k4ainternal::utcommon 9 | gtest::gtest) 10 | 11 | k4a_add_tests(TARGET cpp_projection_ft HARDWARE_REQUIRED TEST_TYPE FUNCTIONAL) 12 | -------------------------------------------------------------------------------- /tests/rwlock/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(rwlock_ft rwlock.cpp) 5 | 6 | target_link_libraries(rwlock_ft PRIVATE 7 | azure::aziotsharedutil 8 | gtest::gtest 9 | k4ainternal::rwlock 10 | k4ainternal::utcommon) 11 | 12 | k4a_add_tests(TARGET rwlock_ft TEST_TYPE FUNCTIONAL) 13 | -------------------------------------------------------------------------------- /tests/throughput/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(throughput_perf throughput_perf.cpp) 5 | 6 | target_compile_definitions(throughput_perf PRIVATE _CRT_SECURE_NO_WARNINGS) 7 | 8 | target_link_libraries(throughput_perf PRIVATE 9 | azure::aziotsharedutil 10 | gtest::gtest 11 | k4a::k4a 12 | k4ainternal::logging 13 | k4ainternal::utcommon) 14 | 15 | k4a_add_tests(TARGET throughput_perf HARDWARE_REQUIRED TEST_TYPE PERF) 16 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_subdirectory(deversion) 5 | add_subdirectory(k4aviewer) 6 | add_subdirectory(k4afastcapture_streaming) 7 | add_subdirectory(k4afastcapture_trigger) 8 | add_subdirectory(k4arecorder) 9 | 10 | if(NOT ${BUILD_OB_K4A_WRAPPER}) 11 | add_subdirectory(updater) 12 | endif() -------------------------------------------------------------------------------- /tools/deversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(deversion main.c) 5 | 6 | target_link_libraries(deversion PRIVATE 7 | k4ainternal::dynlib) 8 | -------------------------------------------------------------------------------- /tools/deversion/README.md: -------------------------------------------------------------------------------- 1 | # Depth Engine Version (deversion) 2 | 3 | This is a simple command line tool to determine the version of the Azure Kinect plugin 4 | that is currently in the loader's path. 5 | 6 | `deversion` will print out the version of the depth engine plugin it loads. If 7 | `deversion` is unable to load a depth engine it will not print out a version. -------------------------------------------------------------------------------- /tools/k4afastcapture_streaming/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | find_package(Threads REQUIRED) 5 | 6 | add_executable(fastcapture_streaming k4afastcapture.cpp main.cpp) 7 | target_link_libraries(fastcapture_streaming PRIVATE 8 | k4a::k4a 9 | "${CMAKE_THREAD_LIBS_INIT}" 10 | ) 11 | -------------------------------------------------------------------------------- /tools/k4afastcapture_streaming/README.md: -------------------------------------------------------------------------------- 1 | # Azure Kinect Fast Capture:streaming 2 | 3 | ## Introduction 4 | 5 | The Azure Kinect Fast Capture streaming process keeps streaming both the color and depth frames. It will store 6 | the most recent frames to the specified folder when notified by [Azure Kinect Fast Capture trigger](../k4afastcapture_trigger/README.md). 7 | 8 | ## Usage Info 9 | 10 | ``` 11 | d:\fastcapture_streaming.exe /? 12 | * fastcapture_streaming.exe Usage Info * 13 | 14 | fastcapture_streaming.exe 15 | [DirectoryPath_Options] [PcmShift_Options (default: 4)] 16 | [StreamingLength_Options (Limit the streaming to N seconds, default: 60)] 17 | [ExposureValue_Options (default: auto exposure)] 18 | 19 | Examples: 20 | 1 - fastcapture_streaming.exe -DirectoryPath C:\data\ 21 | 22 | 2 - fastcapture_streaming.exe -DirectoryPath C:\data\ -PcmShift 5 -StreamingLength 1000 -ExposureValue -3 23 | 24 | 3 - fastcapture_streaming.exe -d C:\data\ -s 4 -l 60 -e -2 25 | ``` -------------------------------------------------------------------------------- /tools/k4afastcapture_trigger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | find_package(Threads REQUIRED) 5 | 6 | add_executable(fastcapture_trigger trigger.cpp) 7 | target_link_libraries(fastcapture_trigger PRIVATE 8 | "${CMAKE_THREAD_LIBS_INIT}" 9 | ) -------------------------------------------------------------------------------- /tools/k4afastcapture_trigger/README.md: -------------------------------------------------------------------------------- 1 | # Azure Kinect Fast Capture:trigger 2 | 3 | ## Introduction 4 | 5 | The Azure Kinect Fast Capture trigger will send a command to the Azure Kinect Fast 6 | Capture streaming process to take a capture. 7 | The Azure Kinect Fast Capture trigger requires that the Azure Kinect Fast Capture 8 | Streaming tool is already running. 9 | 10 | ## Usage Info 11 | 12 | Run `fastcapture_trigger.exe` to take a capture. 13 | 14 | Run `fastcapture_trigger.exe` to exit the streaming process. -------------------------------------------------------------------------------- /tools/k4arecorder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(k4arecorder main.cpp recorder.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.rc) 5 | 6 | target_link_libraries(k4arecorder PRIVATE 7 | k4a::k4a 8 | k4a::k4arecord 9 | ) 10 | 11 | # Include ${CMAKE_CURRENT_BINARY_DIR}/version.rc in the target's sources 12 | # to embed version information 13 | set(K4A_FILEDESCRIPTION "Azure Kinect Recording Tool") 14 | set(K4A_ORIGINALFILENAME "k4arecorder.exe") 15 | configure_file( 16 | ${K4A_VERSION_RC} 17 | ${CMAKE_CURRENT_BINARY_DIR}/version.rc 18 | @ONLY 19 | ) 20 | 21 | # Setup install 22 | include(GNUInstallDirs) 23 | 24 | install( 25 | TARGETS 26 | k4arecorder 27 | RUNTIME DESTINATION 28 | ${CMAKE_INSTALL_BINDIR} 29 | COMPONENT 30 | tools 31 | ) 32 | 33 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 34 | install( 35 | FILES 36 | $ 37 | DESTINATION 38 | ${CMAKE_INSTALL_BINDIR} 39 | COMPONENT 40 | tools 41 | OPTIONAL 42 | ) 43 | endif() -------------------------------------------------------------------------------- /tools/k4arecorder/recorder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef RECORDER_H 5 | #define RECORDER_H 6 | 7 | #include 8 | #include 9 | 10 | extern std::atomic_bool exiting; 11 | 12 | static const int32_t defaultExposureAuto = -12; 13 | static const int32_t defaultGainAuto = -1; 14 | 15 | int do_recording(uint8_t device_index, 16 | char *recording_filename, 17 | int recording_length, 18 | k4a_device_configuration_t *device_config, 19 | bool record_imu, 20 | int32_t absoluteExposureValue, 21 | int32_t gain); 22 | 23 | #endif /* RECORDER_H */ 24 | -------------------------------------------------------------------------------- /tools/k4aviewer/README.md: -------------------------------------------------------------------------------- 1 | # K4AViewer 2 | 3 | ## Introduction 4 | 5 | K4AViewer is a graphical utility that allows you to start Azure Kinect devices in various modes and visualize the data from the sensors. 6 | To use, select a device from the list, click "Open Device", choose the settings you want to start the camera with, then click "Start". 7 | 8 | ## Usage Info 9 | 10 | k4aviewer will try to detect if you have a high-DPI system and scale automatically; however, if you want to force it into or out of 11 | high-DPI mode, you can pass -HighDPI or -NormalDPI to override that behavior. 12 | 13 | ``` 14 | k4aviewer.exe [-HighDPI|-NormalDPI] 15 | ``` -------------------------------------------------------------------------------- /tools/k4aviewer/ik4adockcontrol.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef IK4ADOCKCONTROL_H 5 | #define IK4ADOCKCONTROL_H 6 | 7 | // System headers 8 | // 9 | 10 | // Library headers 11 | // 12 | #include "k4aimgui_all.h" 13 | 14 | // Project headers 15 | // 16 | 17 | namespace k4aviewer 18 | { 19 | 20 | enum class K4ADockControlStatus 21 | { 22 | Ok, 23 | ShouldClose 24 | }; 25 | 26 | class IK4ADockControl 27 | { 28 | public: 29 | virtual K4ADockControlStatus Show() = 0; 30 | 31 | IK4ADockControl() = default; 32 | virtual ~IK4ADockControl() = default; 33 | 34 | IK4ADockControl(const IK4ADockControl &) = delete; 35 | IK4ADockControl &operator=(const IK4ADockControl &) = delete; 36 | IK4ADockControl(const IK4ADockControl &&) = delete; 37 | IK4ADockControl &operator=(const IK4ADockControl &&) = delete; 38 | }; 39 | } // namespace k4aviewer 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /tools/k4aviewer/ik4aobserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef IK4AOBSERVER_H 5 | #define IK4AOBSERVER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | 11 | // Library headers 12 | // 13 | #include 14 | 15 | // Project headers 16 | // 17 | 18 | namespace k4aviewer 19 | { 20 | template class IK4AObserver 21 | { 22 | public: 23 | virtual void NotifyData(const NotificationType &data) = 0; 24 | virtual void NotifyTermination() = 0; 25 | virtual void ClearData() = 0; 26 | 27 | virtual ~IK4AObserver() = default; 28 | 29 | IK4AObserver() = default; 30 | IK4AObserver(const IK4AObserver &) = delete; 31 | IK4AObserver(const IK4AObserver &&) = delete; 32 | IK4AObserver &operator=(const IK4AObserver &) = delete; 33 | IK4AObserver &operator=(const IK4AObserver &&) = delete; 34 | }; 35 | 36 | using IK4ACaptureObserver = IK4AObserver; 37 | using IK4AImuObserver = IK4AObserver; 38 | } // namespace k4aviewer 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tools/k4aviewer/ik4avisualizationwindow.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef IK4AVISUALIZATIONWINDOW_H 5 | #define IK4AVISUALIZATIONWINDOW_H 6 | 7 | // System headers 8 | // 9 | 10 | // Library headers 11 | // 12 | #include "k4aimgui_all.h" 13 | 14 | // Project headers 15 | // 16 | 17 | namespace k4aviewer 18 | { 19 | struct K4AWindowPlacementInfo 20 | { 21 | ImVec2 Size; 22 | ImVec2 Position; 23 | }; 24 | 25 | class IK4AVisualizationWindow 26 | { 27 | public: 28 | // Draw widgets to fill your window (ImGui::Begin()/ImGui::End() will be called for you). 29 | // Size constraints will be automatically applied to your window, but if you want to know 30 | // how much space you have access to, placementInfo has that. 31 | // 32 | virtual void Show(K4AWindowPlacementInfo placementInfo) = 0; 33 | 34 | virtual const char *GetTitle() const = 0; 35 | 36 | IK4AVisualizationWindow() = default; 37 | virtual ~IK4AVisualizationWindow() = default; 38 | 39 | IK4AVisualizationWindow(const IK4AVisualizationWindow &) = delete; 40 | IK4AVisualizationWindow &operator=(const IK4AVisualizationWindow &) = delete; 41 | IK4AVisualizationWindow(const IK4AVisualizationWindow &&) = delete; 42 | IK4AVisualizationWindow &operator=(const IK4AVisualizationWindow &&) = delete; 43 | }; 44 | } // namespace k4aviewer 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aaudiomanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AAUDIOMANAGER_H 5 | #define K4AAUDIOMANAGER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | #include 12 | 13 | // Library headers 14 | // 15 | #include "k4asoundio_util.h" 16 | 17 | // Project headers 18 | // 19 | #include "k4amicrophone.h" 20 | 21 | namespace k4aviewer 22 | { 23 | class K4AAudioManager 24 | { 25 | public: 26 | static K4AAudioManager &Instance(); 27 | 28 | int Initialize(SoundIoBackend backend); 29 | int Initialize(); 30 | 31 | int RefreshDevices(); 32 | 33 | size_t GetDeviceCount() const 34 | { 35 | return m_inputDevices.size(); 36 | } 37 | 38 | std::shared_ptr GetMicrophoneForDevice(const std::string &deviceSerialNumber); 39 | 40 | ~K4AAudioManager() = default; 41 | K4AAudioManager(const K4AAudioManager &) = delete; 42 | K4AAudioManager(const K4AAudioManager &&) = delete; 43 | K4AAudioManager &operator=(const K4AAudioManager &) = delete; 44 | K4AAudioManager &operator=(const K4AAudioManager &&) = delete; 45 | 46 | private: 47 | K4AAudioManager() = default; 48 | 49 | int InitializeImpl(const std::function &initFn); 50 | 51 | SoundIoUniquePtr m_io; 52 | 53 | std::map> m_inputDevices; 54 | }; 55 | } // namespace k4aviewer 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aaudiowindow.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AAUDIOWINDOW_H 5 | #define K4AAUDIOWINDOW_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | 15 | // Project headers 16 | // 17 | #include "ik4avisualizationwindow.h" 18 | #include "k4aaudiochanneldatagraph.h" 19 | #include "k4amicrophonelistener.h" 20 | 21 | namespace k4aviewer 22 | { 23 | class K4AAudioWindow : public IK4AVisualizationWindow 24 | { 25 | public: 26 | explicit K4AAudioWindow(std::string &&title, std::shared_ptr listener); 27 | 28 | void Show(K4AWindowPlacementInfo placementInfo) override; 29 | const char *GetTitle() const override; 30 | 31 | private: 32 | void ProcessNewData(); 33 | 34 | std::string m_title; 35 | 36 | std::shared_ptr m_listener; 37 | 38 | std::array m_channelData; 39 | 40 | float m_microphoneScale = -0.5f; 41 | }; 42 | } // namespace k4aviewer 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4acolorimageconverter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/tools/k4aviewer/k4acolorimageconverter.cpp -------------------------------------------------------------------------------- /tools/k4aviewer/k4acolorimageconverter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ACOLORIMAGECONVERTER_H 5 | #define K4ACOLORIMAGECONVERTER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | #include "k4aimgui_all.h" 15 | 16 | // Project headers 17 | // 18 | #include "ik4aimageconverter.h" 19 | #include "k4aviewerutil.h" 20 | 21 | namespace k4aviewer 22 | { 23 | 24 | class K4AColorImageConverterFactory 25 | { 26 | public: 27 | template 28 | static std::unique_ptr> Create(k4a_color_resolution_t resolution); 29 | }; 30 | 31 | template<> 32 | std::unique_ptr> 33 | K4AColorImageConverterFactory::Create(k4a_color_resolution_t resolution); 34 | 35 | template<> 36 | std::unique_ptr> 37 | K4AColorImageConverterFactory::Create(k4a_color_resolution_t resolution); 38 | 39 | template<> 40 | std::unique_ptr> 41 | K4AColorImageConverterFactory::Create(k4a_color_resolution_t resolution); 42 | 43 | template<> 44 | std::unique_ptr> 45 | K4AColorImageConverterFactory::Create(k4a_color_resolution_t resolution); 46 | } // namespace k4aviewer 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aconvertingimagesource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbbec/OrbbecSDK-K4A-Wrapper/23b10a72fb6b0a30b9759bd5284bb46b32db2fea/tools/k4aviewer/k4aconvertingimagesource.h -------------------------------------------------------------------------------- /tools/k4aviewer/k4adepthimageconverter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ADEPTHIMAGECONVERTER_H 5 | #define K4ADEPTHIMAGECONVERTER_H 6 | 7 | // System headers 8 | // 9 | 10 | // Library headers 11 | // 12 | 13 | // Project headers 14 | // 15 | #include "k4adepthimageconverterbase.h" 16 | #include "k4adepthpixelcolorizer.h" 17 | #include "k4astaticimageproperties.h" 18 | 19 | namespace k4aviewer 20 | { 21 | 22 | class K4ADepthImageConverter 23 | : public K4ADepthImageConverterBase 24 | { 25 | public: 26 | explicit K4ADepthImageConverter(k4a_depth_mode_t depthMode) : 27 | K4ADepthImageConverterBase(depthMode, GetDepthModeRange(depthMode)) 28 | { 29 | } 30 | 31 | ~K4ADepthImageConverter() override = default; 32 | 33 | K4ADepthImageConverter(const K4ADepthImageConverter &) = delete; 34 | K4ADepthImageConverter(const K4ADepthImageConverter &&) = delete; 35 | K4ADepthImageConverter &operator=(const K4ADepthImageConverter &) = delete; 36 | K4ADepthImageConverter &operator=(const K4ADepthImageConverter &&) = delete; 37 | }; 38 | } // namespace k4aviewer 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4adevicecorrelator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ADEVICECORRELATOR_H 5 | #define K4ADEVICECORRELATOR_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | 15 | // Project headers 16 | // 17 | #include "k4asoundio_util.h" 18 | 19 | namespace k4aviewer 20 | { 21 | // Populates result with a map from libsoundio backend ID to USB container ID. 22 | // Implementation of this function is platform-specific. 23 | // Returns true if successful, false otherwise. 24 | // 25 | class K4ADeviceCorrelator 26 | { 27 | public: 28 | static bool GetSoundIoBackendIdToSerialNumberMapping(SoundIo *soundIo, std::map *result); 29 | 30 | K4ADeviceCorrelator() = delete; 31 | }; 32 | } // namespace k4aviewer 33 | #endif // K4ADEVICECORRELATOR_H 34 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4afilepicker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AFILEPICKER_H 5 | #define K4AFILEPICKER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | #include "k4aimgui_all.h" 15 | 16 | // Project headers 17 | // 18 | #include "filesystem17.h" 19 | 20 | namespace k4aviewer 21 | { 22 | class K4AFilePicker 23 | { 24 | public: 25 | K4AFilePicker(); 26 | bool Show(); 27 | std17::filesystem::path GetPath(); 28 | 29 | private: 30 | void ChangeWorkingDirectory(std17::filesystem::path newDirectory); 31 | 32 | static constexpr size_t MaxPath = 4096; 33 | std::array m_currentDirectoryBuffer; 34 | std17::filesystem::path m_selectedPath; 35 | 36 | std::vector m_currentDirectoryFiles; 37 | std::vector m_currentDirectorySubdirectories; 38 | 39 | bool m_filterExtensions = true; 40 | }; 41 | } // namespace k4aviewer 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aimageextractor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AIMAGEEXTRACTOR_H 5 | #define K4AIMAGEEXTRACTOR_H 6 | 7 | // System headers 8 | // 9 | #include 10 | 11 | // Library headers 12 | // 13 | #include 14 | 15 | // Project headers 16 | // 17 | 18 | namespace k4aviewer 19 | { 20 | 21 | // Lets us use a single function signature to pull different types of image out of a capture 22 | // 23 | class K4AImageExtractor 24 | { 25 | public: 26 | template static k4a::image GetImageFromCapture(const k4a::capture &capture) 27 | { 28 | k4a::image img = capture.get_color_image(); 29 | if (!img || img.get_format() != T) 30 | { 31 | return k4a::image(); 32 | } 33 | return img; 34 | } 35 | }; 36 | 37 | template<> 38 | inline k4a::image K4AImageExtractor::GetImageFromCapture(const k4a::capture &capture) 39 | { 40 | return capture.get_depth_image(); 41 | } 42 | 43 | template<> inline k4a::image K4AImageExtractor::GetImageFromCapture(const k4a::capture &capture) 44 | { 45 | return capture.get_ir_image(); 46 | } 47 | 48 | } // namespace k4aviewer 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aimugraph.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AIMUGRAPH_H 5 | #define K4AIMUGRAPH_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | #include 15 | #include "k4aimgui_all.h" 16 | 17 | // Project headers 18 | // 19 | #include "k4aimugraphdatagenerator.h" 20 | 21 | namespace k4aviewer 22 | { 23 | 24 | class K4AImuGraph 25 | { 26 | public: 27 | K4AImuGraph(std::string &&title, 28 | std::string &&xLabel, 29 | std::string &&yLabel, 30 | std::string &&zLabel, 31 | std::string &&units, 32 | float minRange, 33 | float maxRange, 34 | float defaultRange); 35 | 36 | void 37 | Show(ImVec2 maxSize, const K4AImuGraphData::AccumulatorArray &graphData, int graphFrontIdx, uint64_t timestamp); 38 | 39 | private: 40 | void PlotGraph(const char *name, 41 | ImVec2 graphSize, 42 | const K4AImuGraphData::AccumulatorArray &graphData, 43 | int graphFrontIdx, 44 | int offset); 45 | 46 | const std::string m_title; 47 | const std::string m_xLabel; 48 | const std::string m_yLabel; 49 | const std::string m_zLabel; 50 | const std::string m_units; 51 | 52 | const float m_minRange; 53 | const float m_maxRange; 54 | float m_currentRange; 55 | 56 | const std::string m_scaleTitle; 57 | }; 58 | } // namespace k4aviewer 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aimuwindow.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AIMUWINDOW_H 5 | #define K4AIMUWINDOW_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | 12 | // Library headers 13 | // 14 | 15 | // Project headers 16 | // 17 | #include "ik4avisualizationwindow.h" 18 | #include "k4aimugraphdatagenerator.h" 19 | #include "k4aimugraph.h" 20 | 21 | namespace k4aviewer 22 | { 23 | class K4AImuWindow : public IK4AVisualizationWindow 24 | { 25 | public: 26 | void Show(K4AWindowPlacementInfo placementInfo) override; 27 | 28 | const char *GetTitle() const override; 29 | 30 | K4AImuWindow(std::string &&title, std::shared_ptr graphDataGenerator); 31 | ~K4AImuWindow() override = default; 32 | 33 | K4AImuWindow(const K4AImuWindow &) = delete; 34 | K4AImuWindow &operator=(const K4AImuWindow &) = delete; 35 | K4AImuWindow(const K4AImuWindow &&) = delete; 36 | K4AImuWindow &operator=(const K4AImuWindow &&) = delete; 37 | 38 | private: 39 | std::shared_ptr m_graphDataGenerator; 40 | 41 | std::string m_title; 42 | bool m_failed = false; 43 | 44 | K4AImuGraph m_accGraph; 45 | K4AImuGraph m_gyroGraph; 46 | }; 47 | } // namespace k4aviewer 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4ainfraredimageconverter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AINFRAREDIMAGECONVERTER_H 5 | #define K4AINFRAREDIMAGECONVERTER_H 6 | 7 | // System headers 8 | // 9 | 10 | // Library headers 11 | // 12 | 13 | // Project headers 14 | // 15 | #include "k4adepthimageconverterbase.h" 16 | #include "k4adepthpixelcolorizer.h" 17 | 18 | namespace k4aviewer 19 | { 20 | class K4AInfraredImageConverter 21 | : public K4ADepthImageConverterBase 22 | { 23 | public: 24 | explicit K4AInfraredImageConverter(k4a_depth_mode_t depthMode) : 25 | K4ADepthImageConverterBase(depthMode, 26 | GetIrLevels( 27 | depthMode)){}; 28 | 29 | ~K4AInfraredImageConverter() override = default; 30 | 31 | K4AInfraredImageConverter(const K4AInfraredImageConverter &) = delete; 32 | K4AInfraredImageConverter(const K4AInfraredImageConverter &&) = delete; 33 | K4AInfraredImageConverter &operator=(const K4AInfraredImageConverter &) = delete; 34 | K4AInfraredImageConverter &operator=(const K4AInfraredImageConverter &&) = delete; 35 | }; 36 | } // namespace k4aviewer 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4apixel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4APIXEL_H 5 | #define K4APIXEL_H 6 | 7 | // Helper structs/typedefs to cast buffers to 8 | // 9 | namespace k4aviewer 10 | { 11 | 12 | struct BgraPixel 13 | { 14 | uint8_t Blue; 15 | uint8_t Green; 16 | uint8_t Red; 17 | uint8_t Alpha; 18 | }; 19 | 20 | using DepthPixel = uint16_t; 21 | } // namespace k4aviewer 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4asoundio_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ASOUNDIO_UTIL_H 5 | #define K4ASOUNDIO_UTIL_H 6 | 7 | // System headers 8 | // 9 | #include 10 | 11 | // Library headers 12 | // 13 | 14 | // On Windows, this ends up including Windows.h, which by default #defines 15 | // min/max, which overrides std::min/std::max. 16 | // This disables that behavior. 17 | // 18 | #define NOMINMAX 19 | #include 20 | 21 | // Project headers 22 | // 23 | 24 | namespace k4aviewer 25 | { 26 | // Deleter functors for smart pointer types 27 | // 28 | struct SoundIoDeleter 29 | { 30 | void operator()(SoundIo *s) const 31 | { 32 | soundio_destroy(s); 33 | } 34 | }; 35 | 36 | struct SoundIoDeviceDeleter 37 | { 38 | void operator()(SoundIoDevice *s) const 39 | { 40 | soundio_device_unref(s); 41 | } 42 | }; 43 | 44 | struct SoundIoInStreamDeleter 45 | { 46 | void operator()(SoundIoInStream *s) const 47 | { 48 | soundio_instream_destroy(s); 49 | } 50 | }; 51 | 52 | struct SoundIoRingBufferDeleter 53 | { 54 | void operator()(SoundIoRingBuffer *b) const 55 | { 56 | soundio_ring_buffer_destroy(b); 57 | } 58 | }; 59 | 60 | using SoundIoUniquePtr = std::unique_ptr; 61 | using SoundIoInStreamUniquePtr = std::unique_ptr; 62 | using SoundIoRingBufferUniquePtr = std::unique_ptr; 63 | } // namespace k4aviewer 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4asourceselectiondockcontrol.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ASOURCESELECTIONDOCKCONTROL_H 5 | #define K4ASOURCESELECTIONDOCKCONTROL_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | #include 12 | 13 | // Library headers 14 | // 15 | #include "k4aimgui_all.h" 16 | 17 | // Project headers 18 | // 19 | #include "ik4adockcontrol.h" 20 | #include "k4adevicedockcontrol.h" 21 | #include "k4afilepicker.h" 22 | 23 | namespace k4aviewer 24 | { 25 | class K4ASourceSelectionDockControl : public IK4ADockControl 26 | { 27 | public: 28 | K4ASourceSelectionDockControl(); 29 | ~K4ASourceSelectionDockControl() override = default; 30 | 31 | K4ADockControlStatus Show() override; 32 | 33 | K4ASourceSelectionDockControl(const K4ASourceSelectionDockControl &) = delete; 34 | K4ASourceSelectionDockControl(const K4ASourceSelectionDockControl &&) = delete; 35 | K4ASourceSelectionDockControl operator=(const K4ASourceSelectionDockControl &) = delete; 36 | K4ASourceSelectionDockControl operator=(const K4ASourceSelectionDockControl &&) = delete; 37 | 38 | private: 39 | void RefreshDevices(); 40 | 41 | void OpenDevice(); 42 | void OpenRecording(const std17::filesystem::path &path); 43 | 44 | int m_selectedDevice = -1; 45 | std::vector> m_connectedDevices; 46 | 47 | K4AFilePicker m_filePicker; 48 | }; 49 | } // namespace k4aviewer 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4atypeoperators.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4ATYPEOPERATORS_H 5 | #define K4ATYPEOPERATORS_H 6 | 7 | // System headers 8 | // 9 | #include 10 | 11 | // Library headers 12 | // 13 | #include 14 | 15 | // Project headers 16 | // 17 | 18 | namespace k4aviewer 19 | { 20 | // Comparison operators 21 | // 22 | bool operator<(const k4a_version_t &a, const k4a_version_t &b); 23 | 24 | // Output operators for K4A API enum types 25 | // 26 | std::ostream &operator<<(std::ostream &s, const k4a_result_t &val); 27 | std::ostream &operator<<(std::ostream &s, const k4a_buffer_result_t &val); 28 | std::ostream &operator<<(std::ostream &s, const k4a_wait_result_t &val); 29 | std::ostream &operator<<(std::ostream &s, const k4a_color_control_command_t &val); 30 | 31 | std::ostream &operator<<(std::ostream &s, const k4a_wired_sync_mode_t &val); 32 | std::istream &operator>>(std::istream &s, k4a_wired_sync_mode_t &val); 33 | 34 | std::ostream &operator<<(std::ostream &s, const k4a_fps_t &val); 35 | std::istream &operator>>(std::istream &s, k4a_fps_t &val); 36 | 37 | std::ostream &operator<<(std::ostream &s, const k4a_depth_mode_t &val); 38 | std::istream &operator>>(std::istream &s, k4a_depth_mode_t &val); 39 | 40 | std::ostream &operator<<(std::ostream &s, const k4a_color_resolution_t &val); 41 | std::istream &operator>>(std::istream &s, k4a_color_resolution_t &val); 42 | 43 | std::ostream &operator<<(std::ostream &s, const k4a_image_format_t &val); 44 | std::istream &operator>>(std::istream &s, k4a_image_format_t &val); 45 | 46 | } // namespace k4aviewer 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aviewer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AVIEWER_H 5 | #define K4AVIEWER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | 11 | // Library headers 12 | // 13 | #include "k4aimgui_all.h" 14 | 15 | // Project headers 16 | // 17 | #include "k4aviewersettingsmanager.h" 18 | 19 | struct K4AViewerArgs 20 | { 21 | bool HighDpi = false; 22 | }; 23 | 24 | namespace k4aviewer 25 | { 26 | class K4AViewer 27 | { 28 | public: 29 | explicit K4AViewer(const K4AViewerArgs &args); 30 | ~K4AViewer(); 31 | 32 | void Run(); 33 | 34 | K4AViewer(const K4AViewer &) = delete; 35 | K4AViewer(const K4AViewer &&) = delete; 36 | K4AViewer &operator=(const K4AViewer &) = delete; 37 | K4AViewer &operator=(const K4AViewer &&) = delete; 38 | 39 | private: 40 | void ShowMainMenuBar(); 41 | 42 | void SetHighDpi(); 43 | 44 | void ShowErrorOverlay(); 45 | 46 | void ShowViewerOptionMenuItem(const char *msg, ViewerOption option); 47 | 48 | GLFWwindow *m_window; 49 | bool m_showDemoWindow = false; 50 | bool m_showStyleEditor = false; 51 | bool m_showMetricsWindow = false; 52 | bool m_showPerfCounters = false; 53 | }; 54 | } // namespace k4aviewer 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aviewererrormanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AVIEWERERRORMANAGER_H 5 | #define K4AVIEWERERRORMANAGER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | #include 12 | 13 | // Library headers 14 | // 15 | #include 16 | 17 | // Project headers 18 | // 19 | 20 | namespace k4aviewer 21 | { 22 | // Singleton that holds info on the last error detected 23 | // 24 | class K4AViewerErrorManager 25 | { 26 | public: 27 | static K4AViewerErrorManager &Instance(); 28 | 29 | void SetErrorStatus(const char *msg); 30 | void SetErrorStatus(const std::string &msg); 31 | void SetErrorStatus(std::string &&msg); 32 | 33 | void SetErrorStatus(const char *msg, k4a_buffer_result_t result); 34 | void SetErrorStatus(const std::string &msg, k4a_buffer_result_t result); 35 | 36 | void SetErrorStatus(const char *msg, k4a_wait_result_t result); 37 | void SetErrorStatus(const std::string &msg, k4a_wait_result_t result); 38 | 39 | void PopError(); 40 | 41 | bool IsErrorSet() const 42 | { 43 | std::lock_guard lock(m_mutex); 44 | return !m_errors.empty(); 45 | } 46 | 47 | const std::string &GetErrorMessage() const 48 | { 49 | std::lock_guard lock(m_mutex); 50 | return m_errors.front(); 51 | } 52 | 53 | private: 54 | K4AViewerErrorManager() = default; 55 | 56 | std::queue m_errors; 57 | mutable std::mutex m_mutex; 58 | }; 59 | 60 | } // namespace k4aviewer 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /tools/k4aviewer/k4aviewerlogmanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #ifndef K4AVIEWERLOGMANAGER_H 5 | #define K4AVIEWERLOGMANAGER_H 6 | 7 | // System headers 8 | // 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | // Library headers 15 | // 16 | #include 17 | 18 | // Project headers 19 | // 20 | 21 | namespace k4aviewer 22 | { 23 | class IK4AViewerLogListener 24 | { 25 | public: 26 | virtual void Log(k4a_log_level_t severity, const char *file, int line, const char *msg) = 0; 27 | virtual ~IK4AViewerLogListener() = default; 28 | }; 29 | 30 | class K4AViewerLogManager 31 | { 32 | public: 33 | static K4AViewerLogManager &Instance(); 34 | 35 | void Log(k4a_log_level_t severity, const char *file, int line, const char *msg); 36 | 37 | void RegisterListener(std::shared_ptr listener); 38 | 39 | private: 40 | K4AViewerLogManager(); 41 | ~K4AViewerLogManager(); 42 | 43 | static void LoggerCallback(void *context, k4a_log_level_t level, const char *file, int line, const char *msg); 44 | 45 | std::mutex m_mutex; 46 | std::list> m_listeners; 47 | }; 48 | 49 | } // namespace k4aviewer 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /tools/k4aviewer/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "k4aviewer.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | K4AViewerArgs ProcessArgs(int argc, char **argv); 11 | 12 | K4AViewerArgs ProcessArgs(int argc, char **argv) 13 | { 14 | K4AViewerArgs args; 15 | 16 | // Skip argv[0], which is the path to the executable 17 | // 18 | for (int i = 1; i < argc; i++) 19 | { 20 | // Force to uppercase 21 | // 22 | std::string arg = argv[i]; 23 | std::transform(arg.begin(), arg.end(), arg.begin(), [](unsigned char c) { 24 | return static_cast(std::toupper(c)); 25 | }); 26 | 27 | if (arg == "-HIGHDPI") 28 | { 29 | args.HighDpi = true; 30 | } 31 | else if (arg == "-NORMALDPI") 32 | { 33 | args.HighDpi = false; 34 | } 35 | } 36 | 37 | return args; 38 | } 39 | 40 | int main(int argc, char **argv) 41 | { 42 | // add this to avoid failure during depth engine init when multi opengl context using on user app and inside SDK! 43 | k4a::depth_engine_helper::create(); 44 | k4aviewer::K4AViewer viewer(ProcessArgs(argc, argv)); 45 | viewer.Run(); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /tools/updater/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | add_executable(AzureKinectFirmwareTool main.c ${CMAKE_CURRENT_BINARY_DIR}/version.rc) 5 | 6 | # Include ${CMAKE_CURRENT_BINARY_DIR}/version.rc in the target's sources 7 | # to embed version information 8 | set(K4A_FILEDESCRIPTION "Azure Kinect Firmware Tool") 9 | set(K4A_ORIGINALFILENAME "AzureKinectFirmwareTool.exe") 10 | configure_file( 11 | ${K4A_VERSION_RC} 12 | ${CMAKE_CURRENT_BINARY_DIR}/version.rc 13 | @ONLY 14 | ) 15 | 16 | target_compile_definitions(AzureKinectFirmwareTool PRIVATE _CRT_SECURE_NO_WARNINGS) 17 | 18 | target_link_libraries(AzureKinectFirmwareTool PRIVATE 19 | k4ainternal::depth_mcu 20 | k4ainternal::color_mcu 21 | k4ainternal::firmware 22 | k4ainternal::logging 23 | k4ainternal::usb_cmd) 24 | 25 | # Setup install 26 | include(GNUInstallDirs) 27 | 28 | install( 29 | TARGETS 30 | AzureKinectFirmwareTool 31 | RUNTIME DESTINATION 32 | ${CMAKE_INSTALL_BINDIR} 33 | COMPONENT 34 | tools 35 | ) 36 | 37 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 38 | install( 39 | FILES 40 | $ 41 | DESTINATION 42 | ${CMAKE_INSTALL_BINDIR} 43 | COMPONENT 44 | tools 45 | OPTIONAL 46 | ) 47 | endif() 48 | --------------------------------------------------------------------------------