使用 CMake 配置 C++ 示例并在 Windows 的 Visual Studio 中构建它们
说明
下面的屏幕截图提供了分步说明。
安装外部依赖项
根据您要运行的示例程序安装所需的依赖项,见下表。
示例程序 |
PCL |
Eigen |
OpenCV |
OpenCV_Contrib |
---|---|---|---|---|
ReadPCLVis3D |
YES |
|||
CaptureWritePCLVis3D |
YES |
|||
MaskPointCloud |
YES |
YES |
||
PoseConversions |
YES |
YES |
||
UtilizeHandEyeCalibration |
YES |
YES |
||
CaptureUndistortRGB |
YES |
|||
CreateDepthMap |
YES |
|||
TransformPointCloudViaArucoMarker |
YES |
克隆Eigen
The Eigen version that is tested is 3.4.0. This version can be downloaded or cloned from gitlab.com/libeigen/eigen. To clone it, launch the Command Prompt by pressing Win + R keys on the keyboard, then type cmd and press Enter.

导航到要克隆存储库的位置:
cd C:\Users\Public\Downloads
然后运行以下命令(如有必要请安 装 Git ):
git clone https://gitlab.com/libeigen/eigen
Navigate to eigen and checkout version 3.4.0.
cd eigen
git checkout tags/3.4.0

安装PCL
The PCL version that is tested is 1.9.1. Download and install prebuilt PCL binaries: pcl_1.9.1. Check the option to install 3rd Party Libraries including OpenNI.

安装OpenCV
The OpenCV version that is tested is 4.1.0. Download and install prebuilt OpenCV binaries: opencv_4.1.0.

小心
预构建的OpenCV binaries对于需 要 OpenCV_Contrib 的示例来说是不够的。这些示例需要使用额外的模块构建OpenCV。
为PCL和OpenCV设置PATH 系统变量
在构建Zivid C++示例之前,必须对PATH系统变量进行一些设置。
在您的PC上,导航到 Control Panel → System and Security → System → Advanced System Settings → Environment Variables。

在系统变量(窗口底部)下,选择 Path
变量并单击 Edit。
警告
请注意是点击 Edit,而不是 New,以免覆盖PATH系统变量的现有值!

在 Environment variables 窗口中点击 New (窗口的右上角,在用户变量部分)并添加以下值:
C:\Program Files\PCL 1.9.1\bin
C:\Program Files\OpenNI2\Tools
C:\Users\Public\Downloads\opencv\build\x64\vc15\bin
备注
确保您的PCL和OpenCV安装路径是正确的。

克隆C++示例
这是我们 的 GitHub zivid-cpp-samples 存储库。如需克隆它,请通过按键盘上的 Win + R 键启动命令提示符,然后键入 cmd 并按 Enter 键。

导航到要克隆存储库的位置(如果尚未安装 Git,需要先安装它)。
cd C:\Users\Public\Downloads
然后运行以下命令:
git clone https://github.com/zivid/zivid-cpp-samples
使用CMake配置解决方案
运行CMake (cmake-gui.exe),然后设置前两个条目:
Where is the source code |
|
Where to build the binaries |
|

点击 Configure。出现提示时,单 击 Yes 创建一个新的构建目录。

设置前两个条目:
Specify the generator for this project |
Visual Studio 15 2017 |
Optional platform for generator |
x64 |

点击 Configure.

备注
USE_EIGEN
, USE_OPENCV
和 USE_PCL
。USE_ARUCO
配置依赖于ArUco库 (OpenCV_Contrib) 的示例。