C++
サンプルリスト
サンプルには、カメラ と アプリケーション という 2 つの主なカテゴリがあります。 カメラ カテゴリのサンプルは、カメラの使用方法のみに焦点を当てています。 アプリケーション カテゴリのサンプルは、3D 点群、2D 画像、カメラからのその他のデータなど、カメラによって生成された出力を使用します。これらのサンプルは、カメラからのデータがどのように使用されるかを示しています。
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.
Connect - Connect to a Zivid camera using the different available methods.
CreateFileCameraFromZDFWithDiagnostics - Capture a frame with diagnostics enabled and create a file camera from it.
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 with the Zivid camera.
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.
CaptureViaGenICam - Capture using the GenICam interface.
MultiCamera
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
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 a 2D+3D frame and a 2D frame from the Zivid camera with diagnostics enabled.
CheckHealth - Poll the camera health check from a separate thread while capturing in the main thread, printing the statuses and values every second.
ExploreSettingsMetaData - Recursively iterates through all leaf parameters in a Zivid camera’s settings.
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.
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.
Network
AutomaticNetworkConfigurationForCameras - Automatically configure the IP addresses of connected cameras to match the network of the user's PC.
NetworkConfiguration - Uses Zivid API to change the IP address of the Zivid camera.
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
CaptureAndVisualizeNormals - Capture Zivid point clouds, with color and normals, and visualize it in 3D and as a normal map.
CaptureFromFileCameraVis3D - Capture point clouds, with color, with the Zivid file camera and visualize them.
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.
ReadPCLVis3D - Read point cloud from PCL file and visualize it.
FileFormats
ConvertZDF - Convert point cloud data from a ZDF file to your preferred format
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.
MaskPointCloud - Mask point cloud from a ZDF file using the Mask API and visualize it with Zivid::Visualizer.
Visualization
CaptureVis3DInLoop - Capture point clouds, with color, from the Zivid camera, and visualize them in a loop.
CaptureVis3DInLoopWithKeypressExit - Capture point clouds, with color, from the Zivid camera, and visualize them in a loop. Press 'q' to exit.
Cuda
CaptureAndConvertImageWithOpenCVOnCuda - Capture a 2D image with the Zivid SDK and perform RGBA to grayscale conversion on a CUDA device using OpenCV.
Transform
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.
Roi
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.
Stitching
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.
Barcode
BarcodeDetector - Detect and decode linear and matrix barcodes from a 2D capture.
HandEyeCalibration
HandEyeCalibration - Perform Hand-Eye calibration.
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 multiple 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.
Projector
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
手順
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
cmake --build .
一部のサンプルは、外部ライブラリ、特に Eigen 3、OpenCV、PCL、または HALCON に依存しています。これらのライブラリをインストールしたくない場合は、次のオプションをそれぞれ cmake に渡すことで、それらに依存するサンプルを無効にできます。 -DUSE_EIGEN3=OFF 、 -DUSE_OPENCV=OFF 、 -DUSE_PCL=OFF 、 -DUSE_HALCON=OFF 。
オプションの依存関係をインストールし、サンプルがそれらを使用するように構成する方法については オプションの依存関係を使用した C++ サンプルの設定 を参照してください。
サンプルは、例えば以下のように、ビルドディレクトリから実行できます。
./CaptureFromFileCameraVis3D