C++
示例列表
示例主要分为两类:相机 和 应用。 相机 类别中的示例侧重于如何使用相机。 应用 类别中的示例则侧重于使用相机生成的输出,例如3D点云、2D图像或来自相机的其它数据。这些示例展示了可以如何使用来自相机的数据。
Camera
Basic
Capture - Capture point clouds, with color, from the Zivid camera.
Capture2D - Capture 2D images from the Zivid camera.
CaptureAssistant - Capture Assistant to capture point clouds, with color, from the Zivid camera.
CaptureFromFileCamera - Capture point clouds, with color, with the Zivid file camera.
CaptureHDR - Capture HDR point clouds, with color, from the Zivid camera.
CaptureHDRCompleteSettings - Capture point clouds, with color, from the Zivid camera with fully configured settings.
CaptureWithSettingsFromYML - Capture point clouds, with color, from the Zivid camera, with settings from YML file.
Advanced
AllocateMemoryForPointCloudData - Two methods to copy point cloud data from GPU memory to CPU memory, to be consumed by OpenCV.
Capture2DAnd3D - Capture 2D and 3D separately with the Zivid camera.
CaptureHalconViaGenICam - Capture and save a point cloud, with colors, using GenICam interface and Halcon C++ SDK.
CaptureHalconViaZivid - Capture a point cloud, with colors, using Zivid SDK, transform it to a Halcon point cloud and save it using Halcon C++ SDK.
CaptureHDRLoop - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise.
CaptureHDRPrintNormals - Capture Zivid point clouds, compute normals and print a subset.
MultiCameraCaptureInParallel - Capture point clouds with multiple cameras in parallel.
MultiCameraCaptureSequentially - Capture point clouds with multiple cameras sequentially.
MultiCameraCaptureSequentiallyWithInterleavedProcessing - Capture point clouds with multiple cameras sequentially with interleaved processing.
InfoUtilOther
AutomaticNetworkConfigurationForCameras - Automatically set the IP addresses of any number of cameras to be in the same subnet as the provided IP address of the network interface.
CameraInfo - List connected cameras and print camera version and state information for each connected camera.
CameraUserData - Store user data on the Zivid camera.
CaptureWithDiagnostics - Capture point clouds, with color, from the Zivid camera, with settings from YML file and diagnostics enabled.
FirmwareUpdater - Update firmware on the Zivid camera.
FrameInfo - Read frame info from the Zivid camera.
GetCameraIntrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud.
NetworkConfiguration - Uses Zivid API to change the IP address of the Zivid camera.
SettingsInfo - Read settings info from the Zivid camera.
Warmup - Short example of a basic way to warm up the camera with specified time and capture cycle.
ZividBenchmark - Zividbenchmark is a sample that will test the average speed of different operations on your computer.
Maintenance
CorrectCameraInField - Correct the dimension trueness of a Zivid camera.
ResetCameraInField - Reset infield correction on a camera.
VerifyCameraInField - Check the dimension trueness of a Zivid camera.
VerifyCameraInFieldFromZDF - Check the dimension trueness of a Zivid camera from a ZDF file.
Applications
Basic
Visualization
CaptureFromFileCameraVis3D - Capture point clouds, with color, with the Zivid file camera and visualize them.
CaptureHDRVisNormals - Capture Zivid point clouds, with color and normals, and visualize it in 3D and as a normal map.
CaptureVis3D - Capture point clouds, with color, from the Zivid camera, and visualize it.
CaptureWritePCLVis3D - Capture point clouds, with color, from the Zivid camera, save it to PCD file format, and visualize it.
ProjectImageStartAndStop - Start the Image Projection and Stop it.
ReadAndProjectImage - Read a 2D image from file and project it using the camera projector.
ReadPCLVis3D - Read point cloud from PCL file and visualize it.
FileFormats
ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
Advanced
CaptureUndistort2D - Use camera intrinsics to undistort a 2D image.
CreateDepthMap - Convert point cloud from a ZDF file to OpenCV format, extract depth map and visualize it.
Downsample - Downsample point cloud from a ZDF file.
GammaCorrection - Capture 2D image with gamma correction.
HandEyeCalibration - Perform Hand-Eye calibration.
MaskPointCloud - Mask point cloud from a ZDF file and convert to PCL format, extract depth map and visualize it.
ProjectAndFindMarker - Show a marker using the projector, capture a set of 2D images to find the marker coordinates (2D and 3D).
ReprojectPoints - Illuminate checkerboard (Zivid Calibration Board) corners by getting checkerboard pose
ROIBoxViaArucoMarker - Filter the point cloud based on a ROI box given relative to the ArUco marker on a Zivid Calibration Board.
ROIBoxViaCheckerboard - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board.
TransformPointCloudFromMillimetersToMeters - Transform point cloud data from millimeters to meters.
TransformPointCloudViaArucoMarker - Transform a point cloud from camera to ArUco marker coordinate frame by estimating the marker’s pose from the point cloud.
TransformPointCloudViaCheckerboard - Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API.
HandEyeCalibration
PoseConversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector)
UtilizeHandEyeCalibration - Transform single data point or entire point cloud from camera to robot base reference frame using Hand-Eye calibration
MultiCamera
MultiCameraCalibration - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from connected cameras.
MultiCameraCalibrationFromZDF - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from a ZDF files.
StitchByTransformation - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from connected cameras.
StitchByTransformationFromZDF - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from a ZDF files.
操作指南
Windows
点击键盘上的Win+R键启动命令提示符,然后输入 cmd
并 按 Enter 键。
导航到要克隆存储库的位置,然后运行以下命令:
git clone https://github.com/zivid/zivid-cpp-samples
使用CMake配置示例解决方案,在Visual Studio中打开示例,生成并运行。更多相关信息,更多相关信息,请参阅 使用 CMake 配置 C++ 示例并在 Windows 的 Visual Studio 中构建它们。
Ubuntu
点击键盘上的 Ctrl + Alt + T 键打开终端。
导航到要克隆存储库的位置,然后运行以下命令:
git clone https://github.com/zivid/zivid-cpp-samples
cd zivid-cpp-samples
构建项目:
mkdir build
cd build
cmake <options, see below> ../source
make -j
一些示例依赖于外部库,特别是Eigen 3、OpenCV、PCL或HALCON。如果您不想安装这些,您可以通过分别传递以下选项来根据它们禁用示例,以 cmake : -DUSE_EIGEN3=OFF
, -DUSE_OPENCV=OFF
, -DUSE_PCL=OFF
, -DUSE_HALCON=OFF
.
如果您确实想使用它们:
特征 3:设置
-DEIGEN3_INCLUDE_DIR=<path>
在哪里<path>
是Eigen3安装的根目录(包含 Eigen/Core、Eigen/Dense 等的文件夹)PCL 和 OpenCV:如果您的系统上安装了较新的版本,这些示例应该可以正常工作。如果没有,设置
-DPCL_DIR=<path>
/-DOpenCV_DIR=<path>
,<path>
分别是包含了PCLConfig.cmake
和OpenCVConfig.cmake
的目录 。HALCON:如果您的系统上安装了较新的版本,这些示例应该可以正常工作。
现在可以从构建的目录运行示例,例如:
./CaptureFromFileCameraVis3D