1 . 下载Azure Kinect Sensor SDK
git clone -b v1.4.1 https://github.com/microsoft/Azure-Kinect-Sensor-SDK.git
2. 把.gitmodules文件中的git地址,全部替换成gitee的地址
[submodule "extern/cjson/src"]
path = extern/cjson/src
url = https://gitee.com/ningdro/cJSON.git
[submodule "extern/azure_c_shared/src"]
path = extern/azure_c_shared/src
url = https://gitee.com/ningdro/azure-c-shared-utility.git
branch = master
[submodule "extern/spdlog/src"]
path = extern/spdlog/src
url = https://gitee.com/ningdro/spdlog.git
[submodule "extern/libmatroska/src"]
path = extern/libmatroska/src
url = https://gitee.com/ningdro/libmatroska.git
[submodule "extern/libeml/src"]
path = extern/libebml/src
url = https://gitee.com/ningdro/libebml.git
[submodule "extern/imgui/src"]
path = extern/imgui/src
url = https://gitee.com/ocornut/imgui.git
[submodule "extern/googletest/src"]
path = extern/googletest/src
url = https://gitee.com/google/googletest.git
[submodule "extern/glfw/src"]
path = extern/glfw/src
url = https://gitee.com/AaronLJJ/glfw
[submodule "extern/libsoundio/src"]
path = extern/libsoundio/src
url = https://gitee.com/shuangyu8690/libsoundio
[submodule "extern/libjpeg-turbo/src"]
path = extern/libjpeg-turbo/src
url = https://gitee.com/merryinlove/libjpeg-turbo
[submodule "extern/libusb/src"]
path = extern/libusb/src
url = https://gitee.com/jasonbu/libusb
[submodule "extern/libuvc/src"]
path = extern/libuvc/src
url = https://gitee.com/shuangyu8690/libuvc
branch = Azure-Kinect-Sensor-SDK
[submodule "extern/libyuv/src"]
path = extern/libyuv/src
url = https://gitee.com/gezai.com/libyuv.git
3. 安装CMake
$ sudo apt install cmake
4. 从.gitmodules文件中,删除libyuv相关的submodule配置
[submodule "extern/libyuv/src"]
path = extern/libyuv/src
url = https://gitee.com/gezai.com/libyuv.git
5. 配置libyuv
// 删除文件夹
$ cd ${your_clone_dir}
$ rm -rf extern/libyuv/src
$ cd .git
// 删除libyuv相关
$ gedit config
$ git rm --cached extern/libyuv/src
$ git submodule add https://gitee.com/gezai.com/libyuv.git extern/libyuv/src
${your_clone_dir}/.git/config文件的内容最终如下:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://gitee.com/alimteach/Azure-Kinect-Sensor-SDK.git
fetch = +refs/heads/*:refs/remotes/origin/*
[submodule "extern/azure_c_shared/src"]
active = true
url = https://gitee.com/ningdro/azure-c-shared-utility.git
[submodule "extern/cjson/src"]
active = true
url = https://gitee.com/ningdro/cJSON.git
[submodule "extern/glfw/src"]
active = true
url = https://gitee.com/AaronLJJ/glfw
[submodule "extern/googletest/src"]
active = true
url = https://gitee.com/google/googletest.git
[submodule "extern/imgui/src"]
active = true
url = https://gitee.com/ocornut/imgui.git
[submodule "extern/libeml/src"]
active = true
url = https://gitee.com/ningdro/libebml.git
[submodule "extern/libjpeg-turbo/src"]
active = true
url = https://gitee.com/merryinlove/libjpeg-turbo
[submodule "extern/libmatroska/src"]
active = true
url = https://gitee.com/ningdro/libmatroska.git
[submodule "extern/libsoundio/src"]
active = true
url = https://gitee.com/shuangyu8690/libsoundio
[submodule "extern/libusb/src"]
active = true
url = https://gitee.com/jasonbu/libusb
[submodule "extern/libuvc/src"]
active = true
url = https://gitee.com/shuangyu8690/libuvc
[submodule "extern/spdlog/src"]
active = true
url = https://gitee.com/ningdro/spdlog.git
[submodule "extern/libyuv/src"]
url = https://gitee.com/gezai.com/libyuv.git
active = true
[submodule]
recurse = true
6.安装依赖
$ sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev
$ sudo apt-get install uuid-dev
$ sudo apt-get install libssl-dev
$ sudo apt-get install libxrandr-dev
$ sudo apt-get install libxi-dev
$ sudo apt-get install libsdl2-dev
7.安装vulkan(官网:https://vulkan.lunarg.com/sdk/home)
$ wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
$ sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.2.189-bionic.list https://packages.lunarg.com/vulkan/1.2.189/lunarg-vulkan-1.2.189-bionic.list
$ sudo apt update
$ sudo apt install vulkan-sdk
8.安装libusb
$ git clone -b v1.0.24 https://github.com/libusb/libusb.git
$ sudo apt-get install libudev-dev
$ sudo apt-get install automake
$ sudo apt-get install libtool
$ sudo autoreconf -ivf
$ cd ${your_clone_libusb_dir}
$ ./configure && make && make install
9. 编译Azure Kinect Sensor SDK
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc
$ sudo apt-get upgrade libstdc++6
$ cd ${your_clone_sdk_dir}
$ mkdir build
$ cd build
// 下面这两部出错概率很大,出什么错就安装相应的包,之后重新执行相应命令即可
$ cmake .. -GNinja
$ ninja
$ sudo ninja install
$ ln -s ${your_clone_sdk_dir}/sdk/linux_gnu/amd64/release/lib/libdepthengine.so.2.0 ${your_project_dir}/Azure-Kinect-Sensor-SDK/build/bin/libdepthengine.so.2.0
10.使用clion新建c++ executable 工程
CMakeLists.txt文件内容:
cmake_minimum_required(VERSION 3.20)
project(AzureKinectSensor)
set(CMAKE_CXX_STANDARD 11)
add_executable(yaml main.cpp)
target_include_directories(yaml PUBLIC
${your_clone_sdk_dir}/include
)
target_link_libraries(yaml
${your_clone_sdk_dir}/build/bin/libk4a.so
${your_clone_sdk_dir}/build/bin/libk4arecord.so
)
main.cpp内容:
#include <iostream>
#include "k4a/k4a.hpp"
int main() {
std::cout << k4a_device_get_installed_count() << "Hello, World!" << std::endl;
return 0;
}
运行结果:
$ 0Hello, World!
11.安装成功测试后记录,有问题欢迎咨询:ning.dr@foxmail.com
|