From a181a949bc0d378778447d816ee9b71f8badc212 Mon Sep 17 00:00:00 2001 From: builder Date: Fri, 15 Dec 2023 20:35:50 +0000 Subject: [PATCH] Samples: Automatic updates to public repository Remember to do the following: 1. Ensure that modified/deleted/new files are correct 2. Make this commit message relevant for the changes 3. Force push 4. Delete branch after PR is merged If this commit is an update from one SDK version to another, make sure to create a release tag for previous version. --- README.md | 115 +++++++++-------- .../StitchByTransformation.cpp | 3 +- .../StitchByTransformationFromZDF.cpp | 3 +- .../ReprojectPoints/ReprojectPoints.cpp | 2 + .../ProjectImageStartAndStop.cpp | 2 + .../ReadAndProjectImage.cpp | 1 + source/Applications/PointCloudTutorial.md | 2 + source/CMakeLists.txt | 122 ++++++++++++------ .../Capture2DAnd3D/Capture2DAnd3D.cpp | 27 ++-- source/Camera/Basic/CaptureTutorial.md | 3 +- .../CameraInfo.cpp} | 3 +- .../CorrectCameraInField.cpp | 2 +- .../VerifyCameraInField.cpp | 4 +- .../VerifyCameraInFieldFromZDF.cpp | 4 +- source/cmake/3rd-party/FindHDevEngine.cmake | 4 +- source/cmake/3rd-party/FindHalcon.cmake | 6 +- source/cmake/CompilerOptions.cmake | 79 ++++-------- 17 files changed, 205 insertions(+), 177 deletions(-) rename source/Camera/InfoUtilOther/{PrintVersionInfo/PrintVersionInfo.cpp => CameraInfo/CameraInfo.cpp} (81%) diff --git a/README.md b/README.md index 2ff97175..5a9633ef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # C++ samples -This repository contains cpp code samples for Zivid SDK v2.10.1. For +This repository contains cpp code samples for Zivid SDK v2.11.0. For tested compatibility with earlier SDK versions, please check out [accompanying releases](https://github.com/zivid/zivid-cpp-samples/tree/master/../../releases). @@ -40,115 +40,116 @@ from the camera can be used. - **Camera** - **Basic** - - [Capture](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/Capture/Capture.cpp) - Capture point clouds, with color, from the Zivid camera. - - [Capture2D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/Capture2D/Capture2D.cpp) - Capture 2D images from the Zivid camera. - - [CaptureAssistant](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/CaptureAssistant/CaptureAssistant.cpp) - Capture Assistant to capture point clouds, with color, + - [Capture](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/Capture/Capture.cpp) - Capture point clouds, with color, from the Zivid camera. + - [Capture2D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/Capture2D/Capture2D.cpp) - Capture 2D images from the Zivid camera. + - [CaptureAssistant](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cpp) - Capture Assistant to capture point clouds, with color, from the Zivid camera. - - [CaptureFromFileCamera](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cpp) - Capture point clouds, with color, with the Zivid file + - [CaptureFromFileCamera](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cpp) - Capture point clouds, with color, with the Zivid file camera. - - [CaptureHDR](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/CaptureHDR/CaptureHDR.cpp) - Capture HDR point clouds, with color, from the Zivid + - [CaptureHDR](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureHDR/CaptureHDR.cpp) - Capture HDR point clouds, with color, from the Zivid camera. - - [CaptureHDRCompleteSettings](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cpp) - Capture point clouds, with color, from the Zivid camera + - [CaptureHDRCompleteSettings](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cpp) - Capture point clouds, with color, from the Zivid camera with fully configured settings. - - [CaptureWithSettingsFromYML](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cpp) - Capture point clouds, with color, from the Zivid camera, + - [CaptureWithSettingsFromYML](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cpp) - Capture point clouds, with color, from the Zivid camera, with settings from YML file. - **Advanced** - - [AllocateMemoryForPointCloudData](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/AllocateMemoryForPointCloudData/AllocateMemoryForPointCloudData.cpp) - Two methods to copy point cloud data from GPU memory to + - [AllocateMemoryForPointCloudData](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/AllocateMemoryForPointCloudData/AllocateMemoryForPointCloudData.cpp) - Two methods to copy point cloud data from GPU memory to CPU memory, to be consumed by OpenCV. - - [Capture2DAnd3D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp) - Capture 2D and then 3D using various capture strategies, + - [Capture2DAnd3D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp) - Capture 2D and then 3D using various capture strategies, optimizing for both 2D quality and 2D acquisition speed. - - [CaptureHalconViaGenICam](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/CaptureHalconViaGenICam/CaptureHalconViaGenICam.cpp) - Capture and save a point cloud, with colors, using GenICam + - [CaptureHalconViaGenICam](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/CaptureHalconViaGenICam/CaptureHalconViaGenICam.cpp) - Capture and save a point cloud, with colors, using GenICam interface and Halcon C++ SDK. - - [CaptureHalconViaZivid](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/CaptureHalconViaZivid/CaptureHalconViaZivid.cpp) - Capture a point cloud, with colors, using Zivid SDK, + - [CaptureHalconViaZivid](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/CaptureHalconViaZivid/CaptureHalconViaZivid.cpp) - Capture a point cloud, with colors, using Zivid SDK, transform it to a Halcon point cloud and save it using Halcon C++ SDK. - - [CaptureHDRLoop](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cpp) - Cover the same dynamic range in a scene with different + - [CaptureHDRLoop](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cpp) - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise. - - [CaptureHDRPrintNormals](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/CaptureHDRPrintNormals/CaptureHDRPrintNormals.cpp) - Capture Zivid point clouds, compute normals and print a + - [CaptureHDRPrintNormals](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/CaptureHDRPrintNormals/CaptureHDRPrintNormals.cpp) - Capture Zivid point clouds, compute normals and print a subset. - - [MultiCameraCaptureInParallel](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/MultiCameraCaptureInParallel/MultiCameraCaptureInParallel.cpp) - Capture point clouds with multiple cameras in parallel. - - [MultiCameraCaptureSequentially](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/MultiCameraCaptureSequentially/MultiCameraCaptureSequentially.cpp) - Capture point clouds with multiple cameras sequentially. - - [MultiCameraCaptureSequentiallyWithInterleavedProcessing](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Advanced/MultiCameraCaptureSequentiallyWithInterleavedProcessing/MultiCameraCaptureSequentiallyWithInterleavedProcessing.cpp) - Capture point clouds with multiple cameras sequentially + - [MultiCameraCaptureInParallel](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/MultiCameraCaptureInParallel/MultiCameraCaptureInParallel.cpp) - Capture point clouds with multiple cameras in parallel. + - [MultiCameraCaptureSequentially](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/MultiCameraCaptureSequentially/MultiCameraCaptureSequentially.cpp) - Capture point clouds with multiple cameras sequentially. + - [MultiCameraCaptureSequentiallyWithInterleavedProcessing](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/MultiCameraCaptureSequentiallyWithInterleavedProcessing/MultiCameraCaptureSequentiallyWithInterleavedProcessing.cpp) - Capture point clouds with multiple cameras sequentially with interleaved processing. - **InfoUtilOther** - - [CameraUserData](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/CameraUserData/CameraUserData.cpp) - Store user data on the Zivid camera. - - [CaptureWithDiagnostics](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cpp) - Capture point clouds, with color, from the Zivid camera, + - [CameraInfo](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cpp) - List connected cameras and print camera version and state + information for each connected camera. + - [CameraUserData](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/CameraUserData/CameraUserData.cpp) - Store user data on the Zivid camera. + - [CaptureWithDiagnostics](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cpp) - Capture point clouds, with color, from the Zivid camera, with settings from YML file and diagnostics enabled. - - [FirmwareUpdater](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/FirmwareUpdater/FirmwareUpdater.cpp) - Update firmware on the Zivid camera. - - [FrameInfo](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/FrameInfo/FrameInfo.cpp) - Read frame info from the Zivid camera. - - [GetCameraIntrinsics](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cpp) - Read intrinsic parameters from the Zivid camera (OpenCV + - [FirmwareUpdater](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/FirmwareUpdater/FirmwareUpdater.cpp) - Update firmware on the Zivid camera. + - [FrameInfo](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/FrameInfo/FrameInfo.cpp) - Read frame info from the Zivid camera. + - [GetCameraIntrinsics](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cpp) - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud. - - [PrintVersionInfo](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cpp) - List connected cameras and print version information. - - [SettingsInfo](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/SettingsInfo/SettingsInfo.cpp) - Read settings info from the Zivid camera. - - [Warmup](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/Warmup/Warmup.cpp) - Short example of a basic way to warm up the camera with + - [SettingsInfo](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/SettingsInfo/SettingsInfo.cpp) - Read settings info from the Zivid camera. + - [Warmup](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/Warmup/Warmup.cpp) - Short example of a basic way to warm up the camera with specified time and capture cycle. - - [ZividBenchmark](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/ZividBenchmark/ZividBenchmark.cpp) - Zividbenchmarks is a sample that will test the average + - [ZividBenchmark](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/InfoUtilOther/ZividBenchmark/ZividBenchmark.cpp) - Zividbenchmarks is a sample that will test the average speed of different operations on your computer. - **Maintenance** - - [CorrectCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp) - Correct the dimension trueness of a Zivid camera. - - [ResetCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cpp) - Reset infield correction on a camera. - - [VerifyCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp) - Check the dimension trueness of a Zivid camera. - - [VerifyCameraInFieldFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp) - Check the dimension trueness of a Zivid camera from a ZDF + - [CorrectCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp) - Correct the dimension trueness of a Zivid camera. + - [ResetCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cpp) - Reset infield correction on a camera. + - [VerifyCameraInField](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp) - Check the dimension trueness of a Zivid camera. + - [VerifyCameraInFieldFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp) - Check the dimension trueness of a Zivid camera from a ZDF file. - **Applications** - **Basic** - **Visualization** - - [CaptureFromFileCameraVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/CaptureFromFileCameraVis3D/CaptureFromFileCameraVis3D.cpp) - Capture point clouds, with color, with the Zivid file + - [CaptureFromFileCameraVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/CaptureFromFileCameraVis3D/CaptureFromFileCameraVis3D.cpp) - Capture point clouds, with color, with the Zivid file camera and visualize them. - - [CaptureHDRVisNormals](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/CaptureHDRVisNormals/CaptureHDRVisNormals.cpp) - Capture Zivid point clouds, with color and normals, + - [CaptureHDRVisNormals](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/CaptureHDRVisNormals/CaptureHDRVisNormals.cpp) - Capture Zivid point clouds, with color and normals, and visualize it in 3D and as a normal map. - - [CaptureVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/CaptureVis3D/CaptureVis3D.cpp) - Capture point clouds, with color, from the Zivid + - [CaptureVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/CaptureVis3D/CaptureVis3D.cpp) - Capture point clouds, with color, from the Zivid camera, and visualize it. - - [CaptureWritePCLVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/CaptureWritePCLVis3D/CaptureWritePCLVis3D.cpp) - Capture point clouds, with color, from the Zivid + - [CaptureWritePCLVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/CaptureWritePCLVis3D/CaptureWritePCLVis3D.cpp) - Capture point clouds, with color, from the Zivid camera, save it to PCD file format, and visualize it. - - [ProjectImageStartAndStop](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp) - Start the Image Projection and Stop it. - - [ReadAndProjectImage](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp) - Read a 2D image from file and project it using the + - [ProjectImageStartAndStop](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp) - Start the Image Projection and Stop it. + - [ReadAndProjectImage](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp) - Read a 2D image from file and project it using the camera projector. - - [ReadPCLVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/Visualization/ReadPCLVis3D/ReadPCLVis3D.cpp) - Read point cloud from PCL file and visualize it. + - [ReadPCLVis3D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/Visualization/ReadPCLVis3D/ReadPCLVis3D.cpp) - Read point cloud from PCL file and visualize it. - **FileFormats** - - [ReadIterateZDF](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Basic/FileFormats/ReadIterateZDF/ReadIterateZDF.cpp) - Read point cloud data from a ZDF file, iterate through + - [ReadIterateZDF](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Basic/FileFormats/ReadIterateZDF/ReadIterateZDF.cpp) - Read point cloud data from a ZDF file, iterate through it, and extract individual points. - **Advanced** - - [CaptureUndistort2D](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/CaptureUndistort2D/CaptureUndistort2D.cpp) - Use camera intrinsics to undistort a 2D image. - - [CreateDepthMap](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/CreateDepthMap/CreateDepthMap.cpp) - Convert point cloud from a ZDF file to OpenCV format, + - [CaptureUndistort2D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/CaptureUndistort2D/CaptureUndistort2D.cpp) - Use camera intrinsics to undistort a 2D image. + - [CreateDepthMap](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/CreateDepthMap/CreateDepthMap.cpp) - Convert point cloud from a ZDF file to OpenCV format, extract depth map and visualize it. - - [Downsample](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/Downsample/Downsample.cpp) - Downsample point cloud from a ZDF file. - - [GammaCorrection](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/GammaCorrection/GammaCorrection.cpp) - Capture 2D image with gamma correction. - - [HandEyeCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cpp) - Perform Hand-Eye calibration. - - [MaskPointCloud](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/MaskPointCloud/MaskPointCloud.cpp) - Mask point cloud from a ZDF file and convert to PCL + - [Downsample](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/Downsample/Downsample.cpp) - Downsample point cloud from a ZDF file. + - [GammaCorrection](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/GammaCorrection/GammaCorrection.cpp) - Capture 2D image with gamma correction. + - [HandEyeCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cpp) - Perform Hand-Eye calibration. + - [MaskPointCloud](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/MaskPointCloud/MaskPointCloud.cpp) - Mask point cloud from a ZDF file and convert to PCL format, extract depth map and visualize it. - - [ProjectAndFindMarker](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/ProjectAndFindMarker/ProjectAndFindMarker.cpp) - Show a marker using the projector, capture a set of 2D + - [ProjectAndFindMarker](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/ProjectAndFindMarker/ProjectAndFindMarker.cpp) - Show a marker using the projector, capture a set of 2D images to find the marker coordinates (2D and 3D). - - [ReprojectPoints](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp) - Illuminate checkerboard (Zivid Calibration Board) corners + - [ReprojectPoints](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp) - Illuminate checkerboard (Zivid Calibration Board) corners by getting checkerboard pose - - [ROIBoxViaArucoMarker](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cpp) - Filter the point cloud based on a ROI box given relative + - [ROIBoxViaArucoMarker](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cpp) - Filter the point cloud based on a ROI box given relative to the ArUco marker on a Zivid Calibration Board. - - [ROIBoxViaCheckerboard](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cpp) - Filter the point cloud based on a ROI box given relative + - [ROIBoxViaCheckerboard](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cpp) - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board. - - [TransformPointCloudFromMillimetersToMeters](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cpp) - Transform point cloud data from millimeters to meters. - - [TransformPointCloudViaArucoMarker](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cpp) - Transform a point cloud from camera to ArUco Marker + - [TransformPointCloudFromMillimetersToMeters](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cpp) - Transform point cloud data from millimeters to meters. + - [TransformPointCloudViaArucoMarker](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cpp) - Transform a point cloud from camera to ArUco Marker coordinate frame by estimating the marker's pose from the - - [TransformPointCloudViaCheckerboard](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cpp) - Transform a point cloud from camera to checkerboard (Zivid + - [TransformPointCloudViaCheckerboard](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cpp) - Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API. - **HandEyeCalibration** - - [PoseConversions](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/HandEyeCalibration/PoseConversions/PoseConversions.cpp) - Convert to/from Transformation Matrix (Rotation Matrix + - [PoseConversions](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/PoseConversions/PoseConversions.cpp) - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector) - - [UtilizeHandEyeCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cpp) - Transform single data point or entire point cloud from + - [UtilizeHandEyeCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cpp) - Transform single data point or entire point cloud from camera frame to robot base frame using Hand-Eye calibration - **MultiCamera** - - [MultiCameraCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/MultiCamera/MultiCameraCalibration/MultiCameraCalibration.cpp) - Use captures of a calibration object to generate + - [MultiCameraCalibration](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/MultiCamera/MultiCameraCalibration/MultiCameraCalibration.cpp) - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from connected cameras. - - [MultiCameraCalibrationFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/MultiCamera/MultiCameraCalibrationFromZDF/MultiCameraCalibrationFromZDF.cpp) - Use captures of a calibration object to generate + - [MultiCameraCalibrationFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/MultiCamera/MultiCameraCalibrationFromZDF/MultiCameraCalibrationFromZDF.cpp) - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from a ZDF files. - - [StitchByTransformation](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp) - Use transformation matrices from Multi-Camera + - [StitchByTransformation](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp) - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from connected cameras. - - [StitchByTransformationFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp) - Use transformation matrices from Multi-Camera + - [StitchByTransformationFromZDF](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp) - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from a ZDF files. diff --git a/source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp b/source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp index 99ade572..1429752a 100644 --- a/source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp +++ b/source/Applications/Advanced/MultiCamera/StitchByTransformation/StitchByTransformation.cpp @@ -197,7 +197,8 @@ int main(int argc, char **argv) std::cout << "Press r to centre and zoom the viewer so that the entire cloud is visible" << std::endl; std::cout << "Press q to me exit the viewer application" << std::endl; while(!viewer.wasStopped()) - {} + { + } if(saveStitched) { std::cerr << "Saving " << stitchedPointCloud.points.size() diff --git a/source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp b/source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp index 3c6e38e4..accc7a08 100644 --- a/source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp +++ b/source/Applications/Advanced/MultiCamera/StitchByTransformationFromZDF/StitchByTransformationFromZDF.cpp @@ -188,7 +188,8 @@ int main(int argc, char **argv) std::cout << "Press r to centre and zoom the viewer so that the entire cloud is visible" << std::endl; std::cout << "Press q to me exit the viewer application" << std::endl; while(!viewer.wasStopped()) - {} + { + } if(saveStitched) { std::cerr << "Saving " << stitchedPointCloud.points.size() diff --git a/source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp b/source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp index 985ce418..1f05251e 100644 --- a/source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp +++ b/source/Applications/Advanced/ReprojectPoints/ReprojectPoints.cpp @@ -35,6 +35,7 @@ namespace return points; } + std::vector transformGridToCalibrationBoard( const std::vector &grid, const Zivid::Matrix4x4 &transformCameraToCheckerboard) @@ -49,6 +50,7 @@ namespace return pointsInCameraFrame; } + void drawFilledCircles( cv::Mat image, const std::vector &positions, diff --git a/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp b/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp index 13b0f77e..5ced654b 100644 --- a/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp +++ b/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cpp @@ -26,6 +26,7 @@ namespace return projectorImage; } + void projecting(Zivid::Camera &camera, const Zivid::Image &projectorImageFunctionScope) { auto projectedImageHandle = Zivid::Experimental::Projection::showImage(camera, projectorImageFunctionScope); @@ -52,6 +53,7 @@ int main() const auto redColor = Zivid::ColorBGRA(0, 0, 255, 255); auto projectorImage = createProjectorImage(projectorResolution, redColor); + auto projectedImageHandle = Zivid::Experimental::Projection::showImage(camera, projectorImage); std::cout << "Press enter to stop projecting using the \".stop()\" function." << std::endl; diff --git a/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp b/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp index d59705b1..1930b864 100644 --- a/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp +++ b/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cpp @@ -38,6 +38,7 @@ namespace return projectorImage; } + } // namespace int main() diff --git a/source/Applications/PointCloudTutorial.md b/source/Applications/PointCloudTutorial.md index 52274d70..acd3d05e 100644 --- a/source/Applications/PointCloudTutorial.md +++ b/source/Applications/PointCloudTutorial.md @@ -127,6 +127,8 @@ complete list of output data formats and how to copy them from the GPU. | `Zivid::Array2D` | `PointCloud::copyData()` | 16 bytes | 37 MB | | `Zivid::Array2D` | `PointCloud::copyPointsXYZColorsBGRA()` or `PointCloud::copyData()` | 16 bytes | 37 MB | | `Zivid::Image` | `PointCloud::copyImageRGBA()` | 4 bytes | 9 MB | +| `Zivid::Image` | `PointCloud::copyImageBGRA()` | 4 bytes | 9 MB | +| `Zivid::Image` | `PointCloud::copyImagesRGB()` | 4 bytes | 9 MB | Here is an example of how to copy data. diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 759593ff..2cfe6e8c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -2,17 +2,22 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(ZividCppSamples) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rd-party) +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rd-party +) include(CompilerOptions) +set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;") +set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;") + set(ZIVID_VERSION 2.10.0) option(USE_EIGEN3 "Enable samples which depend on Eigen 3" ON) option(USE_OPENCV "Enable samples which depend on OpenCV" ON) option(USE_PCL "Enable samples which depend on Point Cloud Library (PCL)" ON) -option(USE_ARUCO - "Enable samples which depend on ArUco (OpenCV with extra modules)" OFF) +option(USE_ARUCO "Enable samples which depend on ArUco (OpenCV with extra modules)" OFF) option(USE_HALCON "Enable samples which depend on Halcon" OFF) set(SAMPLES @@ -36,7 +41,7 @@ set(SAMPLES Camera/InfoUtilOther/CaptureWithDiagnostics Camera/InfoUtilOther/GetCameraIntrinsics Camera/InfoUtilOther/FirmwareUpdater - Camera/InfoUtilOther/PrintVersionInfo + Camera/InfoUtilOther/CameraInfo Camera/InfoUtilOther/SettingsInfo Camera/InfoUtilOther/FrameInfo Camera/InfoUtilOther/ZividBenchmark @@ -44,6 +49,7 @@ set(SAMPLES Camera/Maintenance/VerifyCameraInField Camera/Maintenance/VerifyCameraInFieldFromZDF Camera/Maintenance/CorrectCameraInField + Camera/Maintenance/ResetCameraInField Applications/Basic/Visualization/CaptureFromFileCameraVis3D Applications/Basic/Visualization/CaptureVis3D Applications/Basic/Visualization/ReadPCLVis3D @@ -70,10 +76,15 @@ set(SAMPLES Applications/Advanced/ROIBoxViaCheckerboard Applications/Advanced/GammaCorrection Applications/Advanced/ProjectAndFindMarker - Applications/Advanced/ReprojectPoints) + Applications/Advanced/ReprojectPoints +) -set(Eigen3_DEPENDING UtilizeHandEyeCalibration PoseConversions - ROIBoxViaArucoMarker ROIBoxViaCheckerboard) +set(Eigen3_DEPENDING + UtilizeHandEyeCalibration + PoseConversions + ROIBoxViaArucoMarker + ROIBoxViaCheckerboard +) set(PCL_DEPENDING Capture2DAnd3D MaskPointCloud @@ -81,7 +92,8 @@ set(PCL_DEPENDING CaptureWritePCLVis3D CaptureHDRVisNormals StitchByTransformation - StitchByTransformationFromZDF) + StitchByTransformationFromZDF +) set(OpenCV_DEPENDING Capture2DAnd3D CaptureUndistort2D @@ -94,7 +106,8 @@ set(OpenCV_DEPENDING GammaCorrection ProjectAndFindMarker ReprojectPoints - ReadAndProjectImage) + ReadAndProjectImage +) set(Visualization_DEPENDING CaptureVis3D CaptureLiveVis3D @@ -104,7 +117,8 @@ set(Visualization_DEPENDING CaptureUndistort2D CreateDepthMap ROIBoxViaArucoMarker - ROIBoxViaCheckerboard) + ROIBoxViaCheckerboard +) set(Clipp_DEPENDING CameraUserData MultiCameraCalibrationFromZDF @@ -114,17 +128,25 @@ set(Clipp_DEPENDING Capture2DAnd3D ZividBenchmark CaptureFromFileCamera - CaptureFromFileCameraVis3D) + CaptureFromFileCameraVis3D +) set(Thread_DEPENDING - Capture2DAnd3D MultiCameraCaptureSequentially MultiCameraCaptureInParallel - MultiCameraCaptureSequentiallyWithInterleavedProcessing ZividBenchmark) -set(ArUco_DEPENDING TransformPointCloudViaArucoMarker ROIBoxViaArucoMarker) -set(Halcon_DEPENDING CaptureHalconViaGenICam CaptureHalconViaZivid) + Capture2DAnd3D + MultiCameraCaptureSequentially + MultiCameraCaptureInParallel + MultiCameraCaptureSequentiallyWithInterleavedProcessing + ZividBenchmark +) +set(ArUco_DEPENDING + TransformPointCloudViaArucoMarker + ROIBoxViaArucoMarker +) +set(Halcon_DEPENDING + CaptureHalconViaGenICam + CaptureHalconViaZivid +) -find_package( - Zivid ${ZIVID_VERSION} - COMPONENTS Core - REQUIRED) +find_package(Zivid ${ZIVID_VERSION} COMPONENTS Core REQUIRED) find_package(Threads REQUIRED) macro(disable_samples DEPENDENCY_NAME) @@ -143,13 +165,13 @@ if(USE_EIGEN3) if(NOT DEFINED EIGEN3_INCLUDE_DIR) message( FATAL_ERROR - "Please point EIGEN3_INCLUDE_DIR to the root directory of your Eigen3 installation (the folder containing Eigen/Core, Eigen/Dense etc.), or disable the Eigen samples (-DUSE_EIGEN3=OFF)." + "Please point EIGEN3_INCLUDE_DIR to the root directory of your Eigen3 installation (the folder containing Eigen/Core, Eigen/Dense etc.), or disable the Eigen samples (-DUSE_EIGEN3=OFF)." ) else() if(NOT IS_DIRECTORY "${EIGEN3_INCLUDE_DIR}/Eigen") message( FATAL_ERROR - "EIGEN3_INCLUDE_DIR was set to ${EIGEN3_INCLUDE_DIR}, which is not a valid Eigen 3 directory. Please correct this, or disable the Eigen samples (-DUSE_EIGEN3=OFF)." + "EIGEN3_INCLUDE_DIR was set to ${EIGEN3_INCLUDE_DIR}, which is not a valid Eigen 3 directory. Please correct this, or disable the Eigen samples (-DUSE_EIGEN3=OFF)." ) endif() endif() @@ -162,7 +184,7 @@ if(USE_PCL) if(NOT PCL_FOUND) message( FATAL_ERROR - "Point Cloud Library (PCL) not found. Please point PCL_DIR to the directory of your PCL installation (containing the file PCLConfig.cmake), or disable the PCL samples with -DUSE_PCL=OFF." + "Point Cloud Library (PCL) not found. Please point PCL_DIR to the directory of your PCL installation (containing the file PCLConfig.cmake), or disable the PCL samples with -DUSE_PCL=OFF." ) endif() else() @@ -170,13 +192,23 @@ else() endif() if(USE_OPENCV) - set(OPENCV_COMMON_MODULES core highgui calib3d) + set(OPENCV_COMMON_MODULES + core + highgui + calib3d + ) if(USE_ARUCO) - find_package(OpenCV 4.1.0 COMPONENTS ${OPENCV_COMMON_MODULES} aruco) + find_package( + OpenCV + 4.1.0 + COMPONENTS + ${OPENCV_COMMON_MODULES} + aruco + ) if(NOT OpenCV_FOUND) message( FATAL_ERROR - "OpenCV not found. Please point OpenCV_DIR to the directory of your OpenCV installation (containing the file OpenCVConfig.cmake). If you don't have OpenCV with extra modules (OpenCV_Contrib), disable the ArUco samples with -DUSE_ARUCO=OFF." + "OpenCV not found. Please point OpenCV_DIR to the directory of your OpenCV installation (containing the file OpenCVConfig.cmake). If you don't have OpenCV with extra modules (OpenCV_Contrib), disable the ArUco samples with -DUSE_ARUCO=OFF." ) endif() else() @@ -185,7 +217,7 @@ if(USE_OPENCV) if(NOT OpenCV_FOUND) message( FATAL_ERROR - "OpenCV not found. Please point OpenCV_DIR to the directory of your OpenCV installation (containing the file OpenCVConfig.cmake), or disable the OpenCV samples with -DUSE_OPENCV=OFF." + "OpenCV not found. Please point OpenCV_DIR to the directory of your OpenCV installation (containing the file OpenCVConfig.cmake), or disable the OpenCV samples with -DUSE_OPENCV=OFF." ) endif() endif() @@ -195,7 +227,10 @@ endif() if(USE_HALCON) if(DEFINED ENV{HALCONROOT} AND NOT $ENV{HALCONROOT} STREQUAL "") - message("Using HALCONROOT " $ENV{HALCONROOT}) + message( + "Using HALCONROOT " + $ENV{HALCONROOT} + ) string(REGEX REPLACE "\\\\" "/" HALCONROOT $ENV{HALCONROOT}) endif() find_package(Halcon REQUIRED) @@ -226,22 +261,19 @@ foreach(SAMPLE ${SAMPLES}) target_link_libraries(${SAMPLE_NAME} Zivid::Core) - target_compile_definitions( - ${SAMPLE_NAME} PRIVATE ZIVID_SAMPLE_DATA_DIR="${ZIVID_SAMPLE_DATA_DIR}") + target_compile_definitions(${SAMPLE_NAME} PRIVATE ZIVID_SAMPLE_DATA_DIR="${ZIVID_SAMPLE_DATA_DIR}") if(${SAMPLE_NAME} IN_LIST Visualization_DEPENDING) target_link_libraries(${SAMPLE_NAME} Zivid::Visualization) endif() if(${SAMPLE_NAME} IN_LIST Eigen3_DEPENDING) - target_include_directories(${SAMPLE_NAME} SYSTEM - PRIVATE ${EIGEN3_INCLUDE_DIR}) + target_include_directories(${SAMPLE_NAME} SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR}) endif() if(${SAMPLE_NAME} IN_LIST PCL_DEPENDING) target_link_libraries(${SAMPLE_NAME} ${PCL_LIBRARIES}) - target_include_directories(${SAMPLE_NAME} SYSTEM - PRIVATE ${PCL_INCLUDE_DIRS}) + target_include_directories(${SAMPLE_NAME} SYSTEM PRIVATE ${PCL_INCLUDE_DIRS}) endif() if(${SAMPLE_NAME} IN_LIST OpenCV_DEPENDING) @@ -249,9 +281,7 @@ foreach(SAMPLE ${SAMPLES}) endif() if(${SAMPLE_NAME} IN_LIST Clipp_DEPENDING) - target_include_directories( - ${SAMPLE_NAME} SYSTEM - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/clipp/include) + target_include_directories(${SAMPLE_NAME} SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/clipp/include) endif() if(${SAMPLE_NAME} IN_LIST Thread_DEPENDING) @@ -259,13 +289,19 @@ foreach(SAMPLE ${SAMPLES}) endif() if(${SAMPLE_NAME} IN_LIST Halcon_DEPENDING) - target_link_libraries(${SAMPLE_NAME} ${HALCON_LIBS} ${HDEVENGINE_LIBS}) + target_link_libraries( + ${SAMPLE_NAME} + ${HALCON_LIBS} + ${HDEVENGINE_LIBS} + ) target_include_directories( - ${SAMPLE_NAME} PUBLIC ${HALCON_INC_DIRS} ${HDEVENGINE_INC_DIRS} - include) + ${SAMPLE_NAME} + PUBLIC + ${HALCON_INC_DIRS} + ${HDEVENGINE_INC_DIRS} + include + ) endif() - endforeach() -target_compile_definitions(ZividBenchmark - PRIVATE OS_NAME=\"${CMAKE_SYSTEM_NAME}\") +target_compile_definitions(ZividBenchmark PRIVATE OS_NAME=\"${CMAKE_SYSTEM_NAME}\") diff --git a/source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp b/source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp index ec725c9b..dba70faa 100644 --- a/source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp +++ b/source/Camera/Advanced/Capture2DAnd3D/Capture2DAnd3D.cpp @@ -2,6 +2,7 @@ Capture 2D and then 3D using various capture strategies, optimizing for both 2D quality and 2D acquisition speed. */ +#include #include #include @@ -17,21 +18,22 @@ Capture 2D and then 3D using various capture strategies, optimizing for both 2D namespace { - cv::Mat mapBGR(const Zivid::Settings::Sampling::Pixel &pixelsToSample, const cv::Mat &fullResolutionBGR) + cv::Mat mapBGR(const Zivid::Experimental::PixelMapping &pixelMapping, const cv::Mat &fullResolutionBGR) { - std::cout << "Pixels to sample: " << pixelsToSample << std::endl; - const int subsampleDivider = - (pixelsToSample.value() == Zivid::Settings::Sampling::Pixel::ValueType::all) ? 1 : 2; - int offset = (pixelsToSample.value() == Zivid::Settings::Sampling::Pixel::ValueType::blueSubsample2x2) ? 0 : 1; - cv::Mat - mappedBGR(fullResolutionBGR.rows / subsampleDivider, fullResolutionBGR.cols / subsampleDivider, CV_8UC3); + std::cout << "Pixel mapping: " << pixelMapping << std::endl; + cv::Mat mappedBGR( + fullResolutionBGR.rows / pixelMapping.rowStride(), + fullResolutionBGR.cols / pixelMapping.colStride(), + CV_8UC3); std::cout << "Mapped width: " << mappedBGR.cols << ", height: " << mappedBGR.rows << std::endl; - for(size_t row = 0; row < static_cast(fullResolutionBGR.rows - offset); row += subsampleDivider) + for(size_t row = 0; row < static_cast(fullResolutionBGR.rows - pixelMapping.rowOffset()); + row += pixelMapping.rowStride()) { - for(size_t col = 0; col < static_cast(fullResolutionBGR.cols - offset); col += subsampleDivider) + for(size_t col = 0; col < static_cast(fullResolutionBGR.cols - pixelMapping.colOffset()); + col += pixelMapping.colStride()) { - mappedBGR.at(row / subsampleDivider, col / subsampleDivider) = - fullResolutionBGR.at(row + offset, col + offset); + mappedBGR.at(row / pixelMapping.rowStride(), col / pixelMapping.colStride()) = + fullResolutionBGR.at(row + pixelMapping.rowOffset(), col + pixelMapping.colOffset()); } } return mappedBGR; @@ -214,9 +216,10 @@ int main(int argc, char **argv) const_cast(static_cast(image.data()))); cv::Mat fullResolutionBGR; cv::cvtColor(fullResolutionBGRA, fullResolutionBGR, cv::COLOR_BGRA2BGR); + const auto pixelMapping = Zivid::Experimental::Calibration::pixelMapping(camera, settings); const auto mappedBGR = (pixelsToSample.value() == Zivid::Settings::Sampling::Pixel::ValueType::all) ? fullResolutionBGR - : mapBGR(pixelsToSample, fullResolutionBGR); + : mapBGR(pixelMapping, fullResolutionBGR); if(pixelsToSample.value() == Zivid::Settings::Sampling::Pixel::ValueType::all) { displayBGR({ fullResolutionBGR }, { "Full resolution 2D" }); diff --git a/source/Camera/Basic/CaptureTutorial.md b/source/Camera/Basic/CaptureTutorial.md index d5609763..58b6da0b 100644 --- a/source/Camera/Basic/CaptureTutorial.md +++ b/source/Camera/Basic/CaptureTutorial.md @@ -98,7 +98,7 @@ You may also list all cameras connected to the computer, and view their serial numbers through ([go to -source](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cpp#L16-L21)) +source](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cpp#L16-L22)) ``` sourceCode cpp auto cameras = zivid.cameras(); @@ -106,6 +106,7 @@ std::cout << "Found " << cameras.size() << " cameras" << std::endl; for(auto &camera : cameras) { std::cout << "Camera Info: " << camera.info() << std::endl; + std::cout << "Camera State: " << camera.state() << std::endl; } ``` diff --git a/source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cpp b/source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cpp similarity index 81% rename from source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cpp rename to source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cpp index 0bc9cd86..5638f9ec 100644 --- a/source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cpp +++ b/source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cpp @@ -1,5 +1,5 @@ /* -List connected cameras and print version information. +List connected cameras and print camera version and state information for each connected camera. */ #include @@ -18,6 +18,7 @@ int main() for(auto &camera : cameras) { std::cout << "Camera Info: " << camera.info() << std::endl; + std::cout << "Camera State: " << camera.state() << std::endl; } } catch(const std::exception &e) diff --git a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp b/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp index e8f7a7dd..738afd73 100644 --- a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp +++ b/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cpp @@ -101,7 +101,7 @@ int main() const auto correction = Zivid::Experimental::Calibration::computeCameraCorrection(dataset); const auto accuracyEstimate = correction.accuracyEstimate(); std::cout - << "If written to the camera, this correction can be expected to yield a dimension accuracy of " + << "If written to the camera, this correction can be expected to yield a dimension accuracy error of " << std::fixed << std::setprecision(2) << 100.0F * accuracyEstimate.dimensionAccuracy() << "% or better in the range of z=[" << static_cast(std::round(accuracyEstimate.zMin())) << "," << static_cast(std::round(accuracyEstimate.zMax())) diff --git a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp b/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp index c37fd416..80fd9ea8 100644 --- a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp +++ b/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cpp @@ -3,7 +3,7 @@ Check the dimension trueness of a Zivid camera. This example shows how to verify the local dimension trueness of a camera. If the trueness is much worse than expected, the camera may have been damaged by -shock in shipping in handling. If so, look at the CorrectCameraInField sample. +shock in shipping or handling. If so, look at the CorrectCameraInField sample. Note: This example uses experimental SDK features, which may be modified, moved, or deleted in the future without notice. */ @@ -51,7 +51,7 @@ int main() // Show results std::cout << "Successful measurement at " << detectionResult.centroid() << std::endl; const auto verification = Zivid::Experimental::Calibration::verifyCamera(input); - std::cout << "Estimated dimension trueness at measured position: " << std::setprecision(2) << std::fixed + std::cout << "Estimated dimension trueness error at measured position: " << std::setprecision(2) << std::fixed << verification.localDimensionTrueness() * 100.0F << "%" << std::endl; } catch(const std::exception &e) diff --git a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp index 0a645ae5..32ac4d88 100644 --- a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp +++ b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cpp @@ -2,7 +2,7 @@ Check the dimension trueness of a Zivid camera from a ZDF file. This example shows how to verify the local dimension trueness of a camera from a ZDF file. If the trueness is much worse -than expected, the camera may have been damaged by shock in shipping in handling. If so, look at the CorrectCameraInField +than expected, the camera may have been damaged by shock in shipping or handling. If so, look at the CorrectCameraInField sample. Why is verifying camera accuracy from a ZDF file useful? @@ -62,7 +62,7 @@ int main() std::cout << "Successful measurement at " << detectionResult.centroid() << std::endl; const auto verification = Zivid::Experimental::Calibration::verifyCamera(input); - std::cout << "Estimated dimension trueness at measured position: " << std::setprecision(2) << std::fixed + std::cout << "Estimated dimension trueness error at measured position: " << std::setprecision(2) << std::fixed << verification.localDimensionTrueness() * 100.0F << "%" << std::endl; } catch(const std::exception &e) diff --git a/source/cmake/3rd-party/FindHDevEngine.cmake b/source/cmake/3rd-party/FindHDevEngine.cmake index 65d5f834..e761f162 100644 --- a/source/cmake/3rd-party/FindHDevEngine.cmake +++ b/source/cmake/3rd-party/FindHDevEngine.cmake @@ -1,3 +1,4 @@ +# gersemi: off if(NOT DEFINED HALCONARCH) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(HALCONARCH x64-macosx) @@ -61,4 +62,5 @@ else() set(HDEVENGINE_LIBS ${PREFIX}hdevenginecpp${SUFFIX}) set(HDEVENGINE_LIBS_XL ${PREFIX}hdevenginecppxl${SUFFIX}) endif() -endif() \ No newline at end of file +endif() +# gersemi: on diff --git a/source/cmake/3rd-party/FindHalcon.cmake b/source/cmake/3rd-party/FindHalcon.cmake index f4ba5c53..caa7ee91 100644 --- a/source/cmake/3rd-party/FindHalcon.cmake +++ b/source/cmake/3rd-party/FindHalcon.cmake @@ -1,3 +1,4 @@ +# gersemi: off if(NOT DEFINED HALCONARCH) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(HALCONARCH x64-macosx) @@ -37,7 +38,7 @@ if(HALCONROOT) endif() endif() - + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(HALCON_EXT_LIB_DIR) set(HALCON_LIBS "-F ${HALCON_EXT_LIB_DIR} -framework HALCON" @@ -81,4 +82,5 @@ else() ${PREFIX}halconcxl${SUFFIX} ${PREFIX}halconcppxl${SUFFIX}) endif() -endif() \ No newline at end of file +endif() +# gersemi: on diff --git a/source/cmake/CompilerOptions.cmake b/source/cmake/CompilerOptions.cmake index f88f9202..989242fd 100644 --- a/source/cmake/CompilerOptions.cmake +++ b/source/cmake/CompilerOptions.cmake @@ -17,21 +17,15 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(WARNINGS_THAT_SHOULD_BE_IGNORED # WHY it is ok to ignore c++98-compat # Code base should be modern c++98-compat-pedantic # Code base should be modern - newline-eof # Legacy warning, no benefit when using modern compilers - # and editors - sign-conversion # Happens a lot in these samples, would complicate - # them too much to handle manually - sign-compare # Happens a lot in these samples, would complicate them - # too much to handle manually - shorten-64-to-32 # Narrowing conversions: Too strict and noisy for - # this code base - padded # The type and order of elements caused the compiler to add - # padding to the end of a struct - conversion # Implicit conversion loses integer precision (signed to - # unsigned). Expected to happen a lot in these samples, - # would complicate them too much to handle manually - double-promotion # We are not concerned about the potential - # performance hit from this. + newline-eof # Legacy warning, no benefit when using modern compilers and editors + sign-conversion # Happens a lot in these samples, would complicate them too much to handle manually + sign-compare # Happens a lot in these samples, would complicate them too much to handle manually + shorten-64-to-32 # Narrowing conversions: Too strict and noisy for this code base + padded # This indicates unused space: The compiler had to insert padding in a struct for alignment. + # Implicit conversion loses integer precision (signed to unsigned). + # Expected to happen a lot in these samples and would complicate them too much to handle manually + conversion + double-promotion # We are not concerned about the potential performance hit from this. ) foreach(WARNING ${WARNINGS_THAT_SHOULD_BE_IGNORED}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-${WARNING}") @@ -61,52 +55,31 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") endif() set(WARNINGS_THAT_SHOULD_BE_IGNORED # WHY it is ok to ignore - 4702 # Got unreachable warnings from external, even though they are - # generallly ignored by /experimental:external - 4710 # If the compiler decides to not inline a function, that's - # their decision - 4711 # If the compiler decides to inline a function, that's their - # decision - 4571 # Just a non-interesting informational warning about msvc - # changing behaviour in 7.1 - 4267 # Conversion: Happens a lot in these samples, would complicate - # them too much to handle manually - 4365 # Conversion: Happens a lot in these samples, would complicate - # them too much to handle manually - 4388 # Signed/unsigned comparison: Happens a lot in these samples, - # would complicate them too much to handle manually - 5045 # Compiler will insert Spectre mitigation for memory load if - # /Qspectre switch specified This warning is purely - # informational - 4244 # Narrowing conversions: Too strict and noisy for this code - # base - 4242 # Narrowing conversions: Too strict and noisy for this code - # base - 4820 # The type and order of elements caused the compiler to add - # padding to the end of a struct - 4868 # compiler may not enforce left-to-right evaluation order in - # braced initializer list - 4355 # #include causes the following: 'this': used in base - # member initializer list - 4996 # Complains about usage of `gmtime`. Ignoring since most - # samples use single thread. - 4514 # Complains about unused inline functions in header files. Too - # strict and noisy for this code base. + 4702 # Got unreachable warnings from external, even though they are generallly ignored by /experimental:external + 4710 # If the compiler decides to not inline a function, that's their decision + 4711 # If the compiler decides to inline a function, that's their decision + 4571 # Just a non-interesting informational warning about msvc changing behaviour in 7.1 + 4267 # Conversion: Happens a lot in these samples, would complicate them too much to handle manually + 4365 # Conversion: Happens a lot in these samples, would complicate them too much to handle manually + 4388 # Signed/unsigned comparison: Happens a lot in these samples, would complicate them too much to handle manually + 5045 # Informs that the compiler will insert Spectre mitigation for memory load if /Qspectre switch is specified + 4244 # Narrowing conversions: Too strict and noisy for this code base + 4242 # Narrowing conversions: Too strict and noisy for this code base + 4820 # The type and order of elements caused the compiler to ad padding to the end of a struct + 4868 # compiler may not enforce left-to-right evaluation order in braced initializer list + 4355 # #include causes the following: 'this': used in base member initializer list + 4996 # Complains about use of `gmtime`. Ignoring since most samples use a single thread. + 4514 # Complains about unused inline functions in header files. Too strict and noisy for this code base. ) foreach(WARNING ${WARNINGS_THAT_SHOULD_BE_IGNORED}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${WARNING}") endforeach() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall") - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} /experimental:external /external:anglebrackets /external:W0" - ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /experimental:external /external:anglebrackets /external:W0") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0") endif() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099") else() - message( - WARNING - "Unknown compiler, not able to set compiler options for ${CMAKE_CXX_COMPILER_ID}" - ) + message(WARNING "Unknown compiler, not able to set compiler options for ${CMAKE_CXX_COMPILER_ID}") endif()