示例

直接使用您喜欢的编程语言对Zivid相机进行编程。

备注

一些Zivid示例需要使用到 Sample Data(示例数据)

示例列表

  • Camera

  • Applications

    • Basic

      • Visualization

      • FileFormats

        • ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.

    • Advanced

      • BarcodeDetector - Detect and decode linear and matrix barcodes from a 2D capture.

      • 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).

      • ReadProjectAndCaptureImage - Read a 2D image from file and project it using the camera projector.

      • ReprojectPoints - Illuminate checkerboard (Zivid Calibration Board) centers by getting the checkerboard feature points

      • 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.

      • StitchContinuouslyRotatingObject - Stitch point clouds from a continuously rotating object without pre-alignment using Local Point Cloud Registration and apply Voxel Downsample.

      • StitchUsingRobotMountedCamera - Stitch multiple point clouds captured with a robot mounted camera.

      • StitchViaLocalPointCloudRegistration - Stitch two point clouds using a transformation estimated by Local Point Cloud Registration and apply Voxel Downsample.

      • 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.

  • Camera

    • Basic

      • Capture - Capture colored point cloud, save 2D image, save 3D ZDF, and export PLY, using the Zivid camera.

      • CaptureFromFileCamera - Capture point clouds, with color, with the Zivid file camera.

      • CaptureHDRCompleteSettings - Capture point clouds, with color, from the Zivid camera with fully configured settings.

      • CaptureWithSettingsFromYML - Capture images and point clouds, with and without color, from the Zivid camera with settings from YML file.

    • Advanced

      • CaptureAndPrintNormals - Capture Zivid point clouds, compute normals and print a subset.

      • 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.

    • InfoUtilOther

      • AutomaticNetworkConfigurationForCameras - * Automatically configure the IP addresses of connected cameras to match the network of the user's PC.

      • 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.

      • MeasureSceneConditions - Measure ambient light conditions in the scene and output the measured flickering frequency of the ambient light if flickering is detected.

      • NetworkConfiguration - Uses Zivid API to change the IP address of the Zivid camera.

      • Warmup - Short example of a basic way to warm up the camera with specified time and capture cycle.

    • Maintenance

  • Applications

访问 zivid-ros Github 存储库。

安装

  1. 安装Zivid软件

  2. 下载Zivid Sample Data

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 分别传递以下选项来禁用依赖于它们的示例: cmake: -DUSE_EIGEN3=OFF-DUSE_OPENCV=OFF-DUSE_PCL=OFF-DUSE_HALCON=OFF

有关如何安装可选依赖项并配置示例以使用它们的说明,请参阅 使用可选依赖项配置 C++ 示例

现在可以从生成的目录运行示例,例如:

./CaptureFromFileCameraVis3D

如需获取更多相关信息,请访问GitHub zivid-cpp-samples 存储库。

  1. 安装Zivid软件

  2. 下载Zivid Sample Data

点击键盘上的Win+R键启动命令提示符,然后键入 cmd ,接着按下 Enter

导航到要克隆的存储库的位置,然后运行以下命令:

git clone https://github.com/zivid/zivid-csharp-samples

在Visual Studio中打开ZividNETSamples.sln,生成并运行它。如果您不确定如何操作,请查看 使用Visual Studio构建C#示例

一些示例依赖于外部库,特别是 MathNet.NumericsSystem.ValueTuple 。在构建示例时,将通过NuGet自动安装这些库。

如需获取更多相关信息,请访问GitHub zivid-csharp-samples 存储库。

备注

这些示例的推荐 Python 版本是 3.7 - 3.9 。

请注意,Open3D 不适用于 Python 3.13 及更高版本。

  1. 安装Zivid软件

  2. 下载Zivid Sample Data

  3. 查看 Zivid Python 示例存储库:

    git clone http://github.com/zivid/zivid-python-samples.git
    
  4. 使用IDE或命令行安装runtime requirements:

cd zivid-python-samples
pip install -r requirements.txt

备注

如果 Open3D 安装失败,请确保您使用的是 Open3D 支持的 Python 版本。或者,您也可以运行以下命令,仅安装非 Open3D 示例所需的依赖项:

pip install ./modules
  1. 打开并运行其中一个示例。

    备注

    在 Windows 上运行 GUI 示例应该通过 pythonw 完成。

如需获取更多相关信息,请访问GitHub zivid-python-samples 存储库。

Zivid 提供两种与 HALCON 接口的方式:

  1. 通过 Zivid SDK,利用 HALCON 提供的 C++/C# 库。我们同时提供 C++C# 。(推荐

  2. 直接使用 Zivid 软件 附带的 GenICam GenTL producer 。

Zivid 和 HALCON 与 Windows 10 和 11 以及 Ubuntu 20.04、22.04、24.04 兼容。

备注

自 SDK 2.10 起,移除了对 Ubuntu 18.04 的支持。

要在这些操作系统之一中设置和使用Zivid,请按照以下页面中各自的说明进行操作:

以下HALCON版本已经过测试并确认可与Zivid相机配合使用:

  • 19.05 Progress, 20.05 Progress, 21.11 Progress, 24.05 Progress, 24.11 Progress-Steady, 25.05 Progress

我们建议使用我们测试过的HALCON版本。

如需获取更多相关信息,请访问GitHub zivid-halcon-samples 存储库。

orphan:

nosearch:

已停止支持 MATLAB。请访问旧版本(<= 2.15)以获取支持。

如需获取更多相关信息,请访问GitHub zivid-matlab-samples 存储库。

查看 zivid-ros GitHub 存储库以获取安装说明、代码示例以及如何开始使用 Zivid ROS 2 驱动程序。如果您使用的是 ROS 1,请参阅 zivid-ros-1 分支。

等同示例

相机

Sample

C++

C#

Python

HDevelop

Basic

Capture

CaptureFromFileCamera

CaptureHdrCompleteSettings

CaptureSavePly

CaptureWithSettingsFromYml

ConnectToSerialNumberCamera

Advanced

AllocateMemoryForPointCloudData

Capture2DAnd3D

CaptureAndPrintNormals

CaptureHalconViaGenICam

CaptureHalconViaZivid

CaptureViaGenICam

MultiCameraCaptureInParallel

MultiCameraCaptureSequentially

MultiCameraCaptureSequentiallyWithInterleavedProcessing

InfoUtilOther

adapt_settings_for_flickering_ambient_light

AutomaticNetworkConfigurationForCameras

CameraInfo

CameraUserData

CaptureWithDiagnostics

context_manager_with_zivid

FirmwareUpdater

FrameInfo

GetCameraIntrinsics

MeasureSceneConditions

NetworkConfiguration

QuerySettingsAndParameters

SettingsInfo

Warmup

ZividBenchmark

Maintenance

CorrectCameraInField

ResetCameraInField

VerifyCameraInField

VerifyCameraInFieldFromZdf

应用

Sample

C++

C#

Python

HDevelop

Basic/Visualization

CaptureAndVisualizeNormals

CaptureFromFileCameraVis3D

CaptureVis3D

CaptureWritePclVis3D

ProjectImageStartAndStop

ReadPclVis3D

read_zdf_vis_3d

Basic/FileFormats

convert_zdf

ReadIterateZdf

ReadPly

Zdf2Ply

Advanced

auto_2d_settings

BarcodeDetector

CaptureUndistort2D

color_balance

CreateDepthMap

Downsample

GammaCorrection

get_checkerboard_pose_from_zdf

HandEyeCalibration

MaskPointCloud

MultiCameraCalibration

ProjectAndFindMarker

ReadProjectAndCaptureImage

ReprojectPoints

RoiBoxViaArucoMarker

RoiBoxViaCheckerboard

StitchContinuouslyRotatingObject

StitchUsingRobotMountedCamera

StitchViaLocalPointCloudRegistration

TransformPointCloudFromMillimetersToMeters

TransformPointCloudViaArucoMarker

TransformPointCloudViaCheckerboard

Advanced/HandEyeCalibration

hand_eye_gui

pose_conversion_gui

PoseConversions

robodk_hand_eye_calibration

UtilizeHandEyeCalibration

verify_hand_eye_with_visualization

Advanced/HandEyeCalibration/UrHandEyeCalibration

universal_robots_perform_hand_eye_calibration

Advanced/HandEyeCalibration/RobodkHandEyeCalibration

robodk_verify_hand_eye_calibration

Advanced/MultiCamera

MultiCameraCalibration

MultiCameraCalibrationFromZdf

StitchByTransformation

StitchByTransformationFromZdf

Advanced/ObjectMatching

SurfaceMatchingCreateModel

SurfaceMatchingCreateModelFromFile

SurfaceMatchingFindModel

SurfaceMatchingFindModelFromFile

Advanced/RobotGuidance

robodk_robot_guidance

模块

Sample

C++

C#

Python

HDevelop

Zividsamples

calibration_board_utils

camera_verification

color_to_grayscale

display

paths

robodk_tools

save_load_matrix

save_load_transformation_matrix

settings_utils

transformation_matrix

white_balance_calibration

操作步骤

Sample

C++

C#

Python

HDevelop

GetFirstAvailableZividDevice

GetSettingsForZividCameraModel

GetZividCameraWidth

GetZividPresetFile

GetZividSampleDataDir