From a98bc403faf9bceb960baa0c25689d386d04df36 Mon Sep 17 00:00:00 2001 From: builder Date: Mon, 30 Sep 2024 10:00:24 +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 | 5 +- .../SurfaceMatchingCreateModel.hdev | 55 +-- .../SurfaceMatchingCreateModelFromFile.hdev | 16 +- .../SurfaceMatchingFindModel.hdev | 79 +++-- .../SurfaceMatchingFindModelFromFile.hdev | 28 +- .../Basic/FileFormats/ReadPLY.hdev | 6 +- source/Camera/Basic/Capture.hdev | 10 + .../Basic/CaptureHDRCompleteSettings.hdev | 17 +- source/Camera/Basic/CaptureSavePLY.hdev | 6 + source/Procedures/get_zivid_camera_width.hdvp | 4 +- .../get_zivid_model_folder_name.hdvp | 4 +- source/Procedures/read_zivid_json_params.hdvp | 329 +++++++----------- .../convert_intrinsics_opencv_to_halcon.py | 19 +- 13 files changed, 260 insertions(+), 318 deletions(-) diff --git a/README.md b/README.md index 8d5f1f9..d2df9d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HDevelop samples -This repository contains halcon code samples for Zivid SDK v2.13.1. For +This repository contains halcon code samples for Zivid SDK v2.11.1. For tested compatibility with earlier SDK versions, please check out [accompanying releases](https://github.com/zivid/zivid-halcon-samples/tree/master/../../releases). @@ -74,8 +74,7 @@ from the camera can be used. If you want to use Zivid in HALCON, we provide a GenICam GenTL producer that comes with the [Zivid Software](http://www.zivid.com/downloads). -Zivid and HALCON are compatible with Windows 10 and 11, and Ubuntu -20.04, 22.04, 24.04. +Zivid and HALCON are compatible with Windows 10 and Ubuntu 20.04, 22.04. ----- diff --git a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModel.hdev b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModel.hdev index 346588b..a36c838 100644 --- a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModel.hdev +++ b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModel.hdev @@ -9,8 +9,8 @@ * It should be used together with the SurfaceMatchingFindModel.hdev where the model created by this program is utilized for surface-based 3D matching algorithm. * This example comes with HDR settings and other parameters which were used to create models of the following three objects: * Twinings tea box - * Pepsi can (0.3 l) - * plastic Coca-Cola bottle (2 l) + * Pringles can (190 g) + * plastic Coca-Cola bottle (0.5 l) * * Please note that you first need to install Zivid Software and correctly set the environment variables. After this, you can access the camera with the HALCON * GenICamTL interface. @@ -37,33 +37,34 @@ * Resetting any previous HDR settings set_framegrabber_param (AcqHandle, 'ResetAcquisitions', 1) - * Setting global settings - set_framegrabber_param (AcqHandle, 'Engine', 'stripe') - set_framegrabber_param (AcqHandle, 'SamplingColor', 'rgb') - set_framegrabber_param (AcqHandle, 'SamplingPixel', 'blueSubsample2x2') - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianSigma', 2.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalThreshold', 2.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseSuppressionEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRepairEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalThreshold', 10.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMaxNeighborDistance', 6) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMinArea', 600) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionEnabled', 0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalEnabled', 0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairHoleSize', 0.7) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairStrictness', 1) - - * Configuring HDR settings + * Configuring HDR settings (Twinings tea box) + *set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + *set_framegrabber_param (AcqHandle, 'Aperture', 5.65) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + *set_framegrabber_param (AcqHandle, 'Aperture', 4.0) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + + * Configuring HDR settings (Pringles can) + *set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + *set_framegrabber_param (AcqHandle, 'Aperture', 4.36) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + *set_framegrabber_param (AcqHandle, 'Aperture', 2.0) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + + * Configuring HDR settings (Coca-Cola bottle) + *set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + *set_framegrabber_param (AcqHandle, 'Aperture', 6.16) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + *set_framegrabber_param (AcqHandle, 'Aperture', 3.08) + *set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + + * Configuring HDR settings (Your own object) set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) - set_framegrabber_param (AcqHandle, 'Aperture', 2.64) + set_framegrabber_param (AcqHandle, 'Aperture', 10.37) set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) - set_framegrabber_param (AcqHandle, 'Aperture', 2.64) + set_framegrabber_param (AcqHandle, 'Aperture', 5.50) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 2.37) set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) * Capturing frame (HDR) diff --git a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModelFromFile.hdev b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModelFromFile.hdev index a46209e..974c7a2 100644 --- a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModelFromFile.hdev +++ b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingCreateModelFromFile.hdev @@ -9,8 +9,8 @@ * It should be used together with the SurfaceMatchingFindModelFromFile.hdev where the model created by this program is utilized for surface-based 3D matching algorithm. * This example comes with models of three following objects: * Twinings tea box - * Pepsi can (0.3 l) - * plastic Coca-Cola bottle (2 l) + * Pringles can (190 g) + * plastic Coca-Cola bottle (0.5 l) * * Please note that you first need to install Zivid Software and correctly set the environment variables. After this, you can access the camera with the HALCON * GenICamTL interface. @@ -25,18 +25,18 @@ * Reading a 3D point cloud of the scene * Twinings tea box SurfaceModelFile:= 'TwiningsTeaBox' - * Pepsi can - * SurfaceModelFile:= 'PepsiCan' + * Pringles can + * SurfaceModelFile:= 'PringlesCan' * Coca-Cola bottle * SurfaceModelFile:= 'CocaColaBottle' import './../../../Procedures' get_zivid_sample_data_dir(ZividDataDir) ScenePath := ZividDataDir + '/ObjectMatching/' + SurfaceModelFile + '/Im1.ply' - * Specify the camera that point cloud was taken with. - Camera := 'Zivid 2+' - * Specify SamplingPixel that point cloud was taken with. - SamplingPixel := 'blueSubsample2x2' + * Specify the camera that point cloud was taken with; options are: 'Zivid One+', 'Zivid 2', and 'Zivid 2+'. + Camera := 'Zivid One+' + * Specify SamplingPixel that point cloud was taken with; options are: 'all', 'blueSubsample2x2', and 'redSubsample2x2' + SamplingPixel := 'all' get_zivid_camera_width (Camera, SamplingPixel, MapWidth) read_object_model_3d (ScenePath, 'm', ['xyz_map_width'], MapWidth, ObjectModel3D_Scene, Status) diff --git a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModel.hdev b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModel.hdev index 3c9bd8e..c9c1375 100644 --- a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModel.hdev +++ b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModel.hdev @@ -9,8 +9,8 @@ * The model used for matching is created from a reference view of the object, see SurfaceMatchingCreateModel.hdev or SurfaceMatchingCreateModel.hdevFromFile. * The model is then searched for in a newly captured 3D point cloud. This example comes with models for the three following objects: * Twinings tea box - * Pepsi can (0.3 l) - * plastic Coca-Cola bottle (2 l) + * Pringles can (190 g) + * plastic Coca-Cola bottle (0.5 l) * * Please note that you first need to install Zivid Software and correctly set the environment variables. After this, you can access the camera with the HALCON * GenICamTL interface. @@ -23,8 +23,8 @@ * Specify the HALCON model for surface-based 3D matching * Existing Twinings tea box model SurfaceModelFile := 'TwiningsTeaBox' - * Existing Pepsi can model - * SurfaceModelFile := 'PepsiCan' + * Existing Pringles can model + * SurfaceModelFile := 'PringlesCan' * Existing Coca-Cola bottle model * SurfaceModelFile := 'CocaColaBottle' * Your own model created with the SurfaceMatchingCreateModel.hdev @@ -54,34 +54,41 @@ * Reseting any previous HDR settings set_framegrabber_param (AcqHandle, 'ResetAcquisitions', 1) - * Setting global settings - set_framegrabber_param (AcqHandle, 'Engine', 'stripe') - set_framegrabber_param (AcqHandle, 'SamplingColor', 'rgb') - set_framegrabber_param (AcqHandle, 'SamplingPixel', 'blueSubsample2x2') - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianSigma', 2.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalThreshold', 2.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseSuppressionEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRepairEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalThreshold', 10.0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMaxNeighborDistance', 6) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMinArea', 600) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionEnabled', 0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalEnabled', 0) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairHoleSize', 0.7) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairStrictness', 1) - * Configuring HDR settings - set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) - set_framegrabber_param (AcqHandle, 'Aperture', 2.64) - set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) - set_framegrabber_param (AcqHandle, 'Aperture', 2.64) - set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + * Twinings tea box + if (SurfaceModelFile = 'TwiningsTeaBox') + set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + set_framegrabber_param (AcqHandle, 'Aperture', 5.50) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 4.00) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + endif + * Pringles can + if (SurfaceModelFile = 'PringlesCan') + set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + set_framegrabber_param (AcqHandle, 'Aperture', 4.36) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 2.37) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + endif + * Coca-Cola bottle + if (SurfaceModelFile = 'CocaColaBottle') + set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + set_framegrabber_param (AcqHandle, 'Aperture', 6.16) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 3.08) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + endif + * Your own model created with the SurfaceMatchingCreateModel.hdev + if (SurfaceModelFile = '') + set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) + set_framegrabber_param (AcqHandle, 'Aperture', 16.00) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 5.50) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + set_framegrabber_param (AcqHandle, 'Aperture', 2.37) + set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) + endif * Loading the HALCON model for surface-based 3D matching if (MySurfaceModelFile) @@ -132,15 +139,15 @@ * RelSamplingDistance - point cloud downsampling (0 = no downsampling) * Twinings tea box if (SurfaceModelFile = 'TwiningsTeaBox') - RelSamplingDistance := 0.03 - endif - * Pepsi can - if (SurfaceModelFile = 'PepsiCan') RelSamplingDistance := 0.01 endif + * Pringles can + if (SurfaceModelFile = 'PringlesCan') + RelSamplingDistance := 0.03 + endif * Coca-Cola bottle if (SurfaceModelFile = 'CocaColaBottle') - RelSamplingDistance := 0.02 + RelSamplingDistance := 0.003 endif * Your own model created with the SurfaceMatchingCreateModel.hdev if (SurfaceModelFile = '') diff --git a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModelFromFile.hdev b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModelFromFile.hdev index 0c7519e..38465d6 100644 --- a/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModelFromFile.hdev +++ b/source/Applications/Advanced/ObjectMatching/SurfaceMatchingFindModelFromFile.hdev @@ -9,8 +9,8 @@ * The model used for matching is created from a reference view of the object, see SurfaceMatchingCreateModelFromFile.hdev. The model is then searched for in a newly * captured 3D point cloud. This example comes with models for the three following objects: * Twinings tea box - * Pepsi can (0.3 l) - * plastic Coca-Cola bottle (2 l) + * Pringles can (190 g) + * plastic Coca-Cola bottle (0.5 l) * * Please note that you first need to install Zivid Software and correctly set the environment variables. After this, you can access the camera with the HALCON * GenICamTL interface. @@ -24,19 +24,19 @@ * Specify the object for surface-based 3D matching * Existing Twinings tea box model - * SurfaceModelFile := 'TwiningsTeaBox' - * Existing Pepsi can model - * SurfaceModelFile := 'PepsiCan' + SurfaceModelFile := 'TwiningsTeaBox' + * Existing Pringles can model + * SurfaceModelFile := 'PringlesCan' * Existing Coca-Cola bottle model - SurfaceModelFile := 'CocaColaBottle' + * SurfaceModelFile := 'CocaColaBottle' import './../../../Procedures' get_zivid_sample_data_dir(ZividDataDir) ScenePath := ZividDataDir + '/ObjectMatching/' + SurfaceModelFile - * Specify the camera that point cloud was taken with; options are: 'Zivid 2' and 'Zivid 2+'. - Camera := 'Zivid 2+' + * Specify the camera that point cloud was taken with; options are: 'Zivid One+', 'Zivid 2', and 'Zivid 2+'. + Camera := 'Zivid One+' * Specify SamplingPixel that point cloud was taken with; options are: 'all', 'blueSubsample2x2', and 'redSubsample2x2' - SamplingPixel := 'blueSubsample2x2' + SamplingPixel := 'all' get_zivid_camera_width (Camera, SamplingPixel, MapWidth) * Specify whether you want to use your own model created with the SurfaceMatchingCreateModelFromFile.hdev @@ -100,15 +100,15 @@ * RelSamplingDistance - point cloud downsampling (0 = no downsampling) * Twinings tea box if (SurfaceModelFile = 'TwiningsTeaBox') - RelSamplingDistance := 0.03 - endif - * Pepsi can - if (SurfaceModelFile = 'PepsiCan') RelSamplingDistance := 0.01 endif + * Pringles can + if (SurfaceModelFile = 'PringlesCan') + RelSamplingDistance := 0.03 + endif * Coca-Cola bottle if (SurfaceModelFile = 'CocaColaBottle') - RelSamplingDistance := 0.02 + RelSamplingDistance := 0.003 endif * KeyPointFraction - additional downsampling for the detection (1 = all points used) KeyPointFraction := 1 diff --git a/source/Applications/Basic/FileFormats/ReadPLY.hdev b/source/Applications/Basic/FileFormats/ReadPLY.hdev index cd97c43..ae45dcd 100644 --- a/source/Applications/Basic/FileFormats/ReadPLY.hdev +++ b/source/Applications/Basic/FileFormats/ReadPLY.hdev @@ -20,10 +20,10 @@ import './../../../Procedures' get_zivid_sample_data_dir(ZividDataDir) PointCloudFile := ZividDataDir + '/Zivid3D.ply' - * Specify the camera that point cloud was taken with; options are: 'Zivid 2' and 'Zivid 2+'. - Camera := 'Zivid 2+' + * Specify the camera that point cloud was taken with; options are: 'Zivid One+', 'Zivid 2', and 'Zivid 2+'. + Camera := 'Zivid One+' * Specify SamplingPixel that point cloud was taken with; options are: 'all', 'blueSubsample2x2', and 'redSubsample2x2' - SamplingPixel := 'blueSubsample2x2' + SamplingPixel := 'all' get_zivid_camera_width (Camera, SamplingPixel, MapWidth) read_object_model_3d (PointCloudFile, 'mm', ['xyz_map_width'], MapWidth, ObjectModel3D, Status) diff --git a/source/Camera/Basic/Capture.hdev b/source/Camera/Basic/Capture.hdev index 1dd1fc2..e8a29d0 100644 --- a/source/Camera/Basic/Capture.hdev +++ b/source/Camera/Basic/Capture.hdev @@ -32,6 +32,16 @@ * Switching to single Frame mode set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'SingleFrame') + * Configuring settings + set_framegrabber_param (AcqHandle, 'Aperture', 5.66) + set_framegrabber_param (AcqHandle, 'ExposureTime', 6500) + set_framegrabber_param (AcqHandle, 'Gain', 1) + set_framegrabber_param (AcqHandle, 'Brightness', 1) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalEnabled', 1) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalThreshold', 5) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianEnabled', 1) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianSigma', 1.5) + * Capturing frame grab_data (Image, Region, Contours, AcqHandle, ObjectModel3D) diff --git a/source/Camera/Basic/CaptureHDRCompleteSettings.hdev b/source/Camera/Basic/CaptureHDRCompleteSettings.hdev index e6cd99c..3d31a2a 100644 --- a/source/Camera/Basic/CaptureHDRCompleteSettings.hdev +++ b/source/Camera/Basic/CaptureHDRCompleteSettings.hdev @@ -43,7 +43,7 @@ * Configuring HDR settings for the first image set_framegrabber_param (AcqHandle, 'Aperture', 8) set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) - set_framegrabber_param (AcqHandle, 'Brightness', 1.8) + set_framegrabber_param (AcqHandle, 'Brightness', 1) set_framegrabber_param (AcqHandle, 'Gain', 1) set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) @@ -51,7 +51,7 @@ * Configuring HDR settings for the second image set_framegrabber_param (AcqHandle, 'Aperture', 4.00) set_framegrabber_param (AcqHandle, 'ExposureTime', 10000) - set_framegrabber_param (AcqHandle, 'Brightness', 1.8) + set_framegrabber_param (AcqHandle, 'Brightness', 1) set_framegrabber_param (AcqHandle, 'Gain', 1) set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) @@ -59,15 +59,15 @@ * Configuring HDR settings for the third image set_framegrabber_param (AcqHandle, 'Aperture', 4.00) set_framegrabber_param (AcqHandle, 'ExposureTime', 40000) - set_framegrabber_param (AcqHandle, 'Brightness', 1.8) + set_framegrabber_param (AcqHandle, 'Brightness', 1) set_framegrabber_param (AcqHandle, 'Gain', 1) set_framegrabber_param (AcqHandle, 'AddAcquisition', 1) * Setting global settings - set_framegrabber_param (AcqHandle, 'Engine', 'phase') + set_framegrabber_param (AcqHandle, 'ExperimentalEngine', 'phase') set_framegrabber_param (AcqHandle, 'SamplingColor', 'rgb') - set_framegrabber_param (AcqHandle, 'SamplingPixel', 'blueSubsample2x2') + set_framegrabber_param (AcqHandle, 'SamplingPixel', 'all') set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxEnabled', 1) set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOX', 1000) set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOY', 1000) @@ -99,10 +99,9 @@ set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionStrength', 0.4) set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalEnabled', 1) set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalThreshold', 0.5) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairEnabled', 1) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairHoleSize', 0.2) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairStrictness', 1) - set_framegrabber_param (AcqHandle, 'ProcessingResamplingMode', 'upsample2x2') + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingEnabled', 1) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingHoleSize', 0.2) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingStrictness', 1) set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceBlue', 1) set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceGreen', 1) set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceRed', 1) diff --git a/source/Camera/Basic/CaptureSavePLY.hdev b/source/Camera/Basic/CaptureSavePLY.hdev index af6d7d9..71aab96 100644 --- a/source/Camera/Basic/CaptureSavePLY.hdev +++ b/source/Camera/Basic/CaptureSavePLY.hdev @@ -31,6 +31,12 @@ * Switching to single acquisition mode set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'SingleFrame') + * Configuring settings + set_framegrabber_param (AcqHandle, 'Aperture', 5.66) + set_framegrabber_param (AcqHandle, 'ExposureTime', 6500) + set_framegrabber_param (AcqHandle, 'Gain', 1) + set_framegrabber_param (AcqHandle, 'Brightness', 1) + * Capturing frame grab_data (Image, Region, Contours, AcqHandle, ObjectModel3D) diff --git a/source/Procedures/get_zivid_camera_width.hdvp b/source/Procedures/get_zivid_camera_width.hdvp index 0bdbcc9..f4de5e7 100644 --- a/source/Procedures/get_zivid_camera_width.hdvp +++ b/source/Procedures/get_zivid_camera_width.hdvp @@ -11,7 +11,9 @@ - if (Camera == 'Zivid 2') + if (Camera == 'Zivid One+') + Width := 1920 + elseif (Camera == 'Zivid 2') Width := 1944 elseif (Camera == 'Zivid 2+') Width := 2448 diff --git a/source/Procedures/get_zivid_model_folder_name.hdvp b/source/Procedures/get_zivid_model_folder_name.hdvp index 8350d31..7e8f6ab 100644 --- a/source/Procedures/get_zivid_model_folder_name.hdvp +++ b/source/Procedures/get_zivid_model_folder_name.hdvp @@ -11,7 +11,9 @@ tuple_split(DeviceModelName, ' ', Substrings) - if (Substrings[1] == '2') + if (Substrings[1] == 'One') + ZividFolder := 'zividOne' + elseif (Substrings[1] == '2') ZividFolder := 'zivid2' elseif (Substrings[1] == '2+') ZividFolder := 'zivid2Plus' diff --git a/source/Procedures/read_zivid_json_params.hdvp b/source/Procedures/read_zivid_json_params.hdvp index e1fd37f..3988d61 100644 --- a/source/Procedures/read_zivid_json_params.hdvp +++ b/source/Procedures/read_zivid_json_params.hdvp @@ -12,8 +12,6 @@ get_dict_tuple (Settings, 'Acquisitions', Acquisitions) get_dict_param (Acquisitions, 'keys', [], AllKeys) - NonExistingKeys := [] - * Single Capture or HDR if (|AllKeys|==1) set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'SingleFrame') @@ -37,242 +35,149 @@ endfor * Engine - get_dict_param(Settings, 'key_exists', 'Engine', KeyExists) - if (KeyExists) - get_dict_tuple (Settings, 'Engine', Engine) - set_framegrabber_param (AcqHandle, 'Engine', Engine) - else - NonExistingKeys := [NonExistingKeys, 'Engine'] - endif + get_dict_tuple (Settings, 'Experimental', Experimental) + get_dict_tuple (Experimental, 'Engine', Engine) + set_framegrabber_param (AcqHandle, 'ExperimentalEngine', Engine) * Sampling - get_dict_param(Settings, 'key_exists', 'Sampling', KeyExists) - if (KeyExists) - get_dict_tuple (Settings, 'Sampling', Sampling) - get_dict_tuple (Sampling, 'Color', SamplingColor) - get_dict_tuple (Sampling, 'Pixel', SamplingPixel) - set_framegrabber_param (AcqHandle, 'SamplingColor', SamplingColor) - set_framegrabber_param (AcqHandle, 'SamplingPixel', SamplingPixel) - else - NonExistingKeys := [NonExistingKeys, 'Sampling'] - endif + get_dict_tuple (Settings, 'Sampling', Sampling) + get_dict_tuple (Sampling, 'Color', SamplingColor) + get_dict_tuple (Sampling, 'Pixel', SamplingPixel) + set_framegrabber_param (AcqHandle, 'SamplingColor', SamplingColor) + set_framegrabber_param (AcqHandle, 'SamplingPixel', SamplingPixel) * RegionOfInterest - get_dict_param(Settings, 'key_exists', 'RegionOfInterest', KeyExists) - if (KeyExists) - get_dict_tuple (Settings, 'RegionOfInterest', RegionOfInterest) - else - NonExistingKeys := [NonExistingKeys, 'RegionOfInterest'] - endif + get_dict_tuple (Settings, 'RegionOfInterest', RegionOfInterest) * Box - get_dict_param(RegionOfInterest, 'key_exists', 'Box', KeyExists) - if (KeyExists) - get_dict_tuple (RegionOfInterest, 'Box', Box) - get_dict_tuple (Box, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxEnabled', Enabled) - get_dict_tuple (Box, 'Extents', Extents) - get_dict_tuple (Extents, 0, ExtentsMin) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxExtentsMin', ExtentsMin) - get_dict_tuple (Extents, 1, ExtentsMax) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxExtentsMax', ExtentsMax) - get_dict_tuple (Box, 'PointO', PointO) - get_dict_tuple (PointO, 0, PointOX) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOX', PointOX) - get_dict_tuple (PointO, 1, PointOY) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOY', PointOY) - get_dict_tuple (PointO, 2, PointOZ) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOZ', PointOZ) - get_dict_tuple (Box, 'PointA', PointA) - get_dict_tuple (PointA, 0, PointAX) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAX', PointAX) - get_dict_tuple (PointA, 1, PointAY) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAY', PointAY) - get_dict_tuple (PointA, 2, PointAZ) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAZ', PointAZ) - get_dict_tuple (Box, 'PointB', PointB) - get_dict_tuple (PointB, 0, PointBX) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBX', PointBX) - get_dict_tuple (PointB, 1, PointBY) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBY', PointBY) - get_dict_tuple (PointB, 2, PointBZ) - set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBZ', PointBZ) - else - NonExistingKeys := [NonExistingKeys, 'RegionOfInterestBox'] - endif + get_dict_tuple (RegionOfInterest, 'Box', Box) + get_dict_tuple (Box, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxEnabled', Enabled) + get_dict_tuple (Box, 'Extents', Extents) + get_dict_tuple (Extents, 0, ExtentsMin) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxExtentsMin', ExtentsMin) + get_dict_tuple (Extents, 1, ExtentsMax) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxExtentsMax', ExtentsMax) + get_dict_tuple (Box, 'PointO', PointO) + get_dict_tuple (PointO, 0, PointOX) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOX', PointOX) + get_dict_tuple (PointO, 1, PointOY) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOY', PointOY) + get_dict_tuple (PointO, 2, PointOZ) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointOZ', PointOZ) + get_dict_tuple (Box, 'PointA', PointA) + get_dict_tuple (PointA, 0, PointAX) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAX', PointAX) + get_dict_tuple (PointA, 1, PointAY) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAY', PointAY) + get_dict_tuple (PointA, 2, PointAZ) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointAZ', PointAZ) + get_dict_tuple (Box, 'PointB', PointB) + get_dict_tuple (PointB, 0, PointBX) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBX', PointBX) + get_dict_tuple (PointB, 1, PointBY) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBY', PointBY) + get_dict_tuple (PointB, 2, PointBZ) + set_framegrabber_param (AcqHandle, 'RegionOfInterestBoxPointBZ', PointBZ) * Depth - get_dict_param(RegionOfInterest, 'key_exists', 'Depth', KeyExists) - if (KeyExists) - get_dict_tuple (RegionOfInterest, 'Depth', Depth) - get_dict_tuple (Depth, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthEnabled', 1) - get_dict_tuple (Depth, 'Range', Range) - get_dict_tuple (Range, 0, RangeMin) - set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthRangeMin', RangeMin) - get_dict_tuple (Range, 1, RangeMax) - set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthRangeMax', RangeMax) - else - NonExistingKeys := [NonExistingKeys, 'RegionOfInterestDepth'] - endif + get_dict_tuple (RegionOfInterest, 'Depth', Depth) + get_dict_tuple (Depth, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthEnabled', 1) + get_dict_tuple (Depth, 'Range', Range) + get_dict_tuple (Range, 0, RangeMin) + set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthRangeMin', RangeMin) + get_dict_tuple (Range, 1, RangeMax) + set_framegrabber_param (AcqHandle, 'RegionOfInterestDepthRangeMax', RangeMax) * Processing Settings get_dict_tuple (Settings, 'Processing', Processing) get_dict_tuple (Processing, 'Filters', Filters) * Cluster Filter - get_dict_param(Filters, 'key_exists', 'Cluster', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Cluster', Cluster) - get_dict_tuple (Cluster, 'Removal', Removal) - get_dict_tuple (Removal, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalEnabled', Enabled) - get_dict_tuple (Removal, 'MaxNeighborDistance', MaxNeighborDistance) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMaxNeighborDistance', MaxNeighborDistance) - get_dict_tuple (Removal, 'MinArea', MinArea) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMinArea', MinArea) - else - NonExistingKeys := [NonExistingKeys, 'ClusterFilter'] - endif + get_dict_tuple (Filters, 'Cluster', Cluster) + get_dict_tuple (Cluster, 'Removal', Removal) + get_dict_tuple (Removal, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalEnabled', Enabled) + get_dict_tuple (Removal, 'MaxNeighborDistance', MaxNeighborDistance) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMaxNeighborDistance', MaxNeighborDistance) + get_dict_tuple (Removal, 'MinArea', MinArea) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersClusterRemovalMinArea', MinArea) * Noise Filter - get_dict_param(Filters, 'key_exists', 'Noise', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Noise', Noise) - get_dict_tuple (Noise, 'Removal', Removal) - get_dict_tuple (Removal, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalEnabled', Enabled) - get_dict_tuple (Removal, 'Threshold', Threshold) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalThreshold', Threshold) - get_dict_tuple (Noise, 'Suppression', Suppression) - get_dict_tuple (Suppression, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseSuppressionEnabled', Enabled) - get_dict_tuple (Noise, 'Repair', Repair) - get_dict_tuple (Repair, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRepairEnabled', Enabled) - else - NonExistingKeys := [NonExistingKeys, 'NoiseFilter'] - endif + get_dict_tuple (Filters, 'Noise', Noise) + get_dict_tuple (Noise, 'Removal', Removal) + get_dict_tuple (Removal, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalEnabled', Enabled) + get_dict_tuple (Removal, 'Threshold', Threshold) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRemovalThreshold', Threshold) + get_dict_tuple (Noise, 'Suppression', Suppression) + get_dict_tuple (Suppression, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseSuppressionEnabled', Enabled) + get_dict_tuple (Noise, 'Repair', Repair) + get_dict_tuple (Repair, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersNoiseRepairEnabled', Enabled) * Outlier Filter - get_dict_param(Filters, 'key_exists', 'Outlier', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Outlier', Outlier) - get_dict_tuple (Outlier, 'Removal', Removal) - get_dict_tuple (Removal, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalEnabled', Enabled) - get_dict_tuple (Removal, 'Threshold', Threshold) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalThreshold', Threshold) - else - NonExistingKeys := [NonExistingKeys, 'OutlierFilter'] - endif + get_dict_tuple (Filters, 'Outlier', Outlier) + get_dict_tuple (Outlier, 'Removal', Removal) + get_dict_tuple (Removal, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalEnabled', Enabled) + get_dict_tuple (Removal, 'Threshold', Threshold) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersOutlierRemovalThreshold', Threshold) * Reflection Filter - get_dict_param(Filters, 'key_exists', 'Reflection', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Reflection', Reflection) - get_dict_tuple (Reflection, 'Removal', Removal) - get_dict_tuple (Removal, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalEnabled', Enabled) - get_dict_tuple (Removal, 'Mode', Mode) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalMode', Mode) - else - NonExistingKeys := [NonExistingKeys, 'ReflectionFilter'] - endif + get_dict_tuple (Filters, 'Reflection', Reflection) + get_dict_tuple (Reflection, 'Removal', Removal) + get_dict_tuple (Removal, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalEnabled', Enabled) + get_dict_tuple (Removal, 'Experimental', Experimental) + get_dict_tuple (Experimental, 'Mode', Mode) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersReflectionRemovalExperimentalMode', Mode) * Smoothing Filter - get_dict_param(Filters, 'key_exists', 'Smoothing', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Smoothing', Smoothing) - get_dict_tuple (Smoothing, 'Gaussian', Gaussian) - get_dict_tuple (Gaussian, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianEnabled', Enabled) - get_dict_tuple (Gaussian, 'Sigma', Sigma) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianSigma', Sigma) - else - NonExistingKeys := [NonExistingKeys, 'SmoothingFilter'] - endif + get_dict_tuple (Filters, 'Smoothing', Smoothing) + get_dict_tuple (Smoothing, 'Gaussian', Gaussian) + get_dict_tuple (Gaussian, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianEnabled', Enabled) + get_dict_tuple (Gaussian, 'Sigma', Sigma) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersSmoothingGaussianSigma', Sigma) * ContrastDistortion Filter - get_dict_param(Filters, 'key_exists', 'Experimental', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Experimental', Experimental) - get_dict_param(Experimental, 'key_exists', 'ContrastDistortion', KeyExists) - if (KeyExists) - get_dict_tuple (Experimental, 'ContrastDistortion', ContrastDistortion) - get_dict_tuple (ContrastDistortion, 'Correction', Correction) - get_dict_tuple (Correction, 'Enabled', Enabled) - get_dict_tuple (Correction, 'Strength', Strength) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionEnabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionStrength', Strength) - get_dict_tuple (ContrastDistortion, 'Removal', Removal) - get_dict_tuple (Removal, 'Enabled', Enabled) - get_dict_tuple (Removal, 'Threshold', Threshold) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalEnabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalThreshold', Threshold) - else - NonExistingKeys := [NonExistingKeys, 'ContrastDistortionFilter'] - endif - else - NonExistingKeys := [NonExistingKeys, 'Experimental'] - endif - - * Hole Repair Filter - get_dict_param(Filters, 'key_exists', 'Hole', KeyExists) - if (KeyExists) - get_dict_tuple (Filters, 'Hole', Hole) - get_dict_tuple (Hole, 'Repair', Repair) - get_dict_tuple (Repair, 'Enabled', Enabled) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairEnabled', Enabled) - get_dict_tuple (Repair, 'HoleSize', HoleSize) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairHoleSize', HoleSize) - get_dict_tuple (Repair, 'Strictness', Strictness) - set_framegrabber_param (AcqHandle, 'ProcessingFiltersHoleRepairStrictness', Strictness) - else - NonExistingKeys := [NonExistingKeys, 'HoleRepairFilter'] - endif - - * Resampling - get_dict_param(Processing, 'key_exists', 'Resampling', KeyExists) - if (KeyExists) - get_dict_tuple(Processing, 'Resampling', Resampling) - get_dict_tuple(Resampling, 'Mode', Mode) - set_framegrabber_param(AcqHandle, 'ProcessingResamplingMode', Mode) - else - NonExistingKeys := [NonExistingKeys, 'Resampling'] - endif + get_dict_tuple (Filters, 'Experimental', Experimental) + get_dict_tuple (Experimental, 'ContrastDistortion', ContrastDistortion) + get_dict_tuple (ContrastDistortion, 'Correction', Correction) + get_dict_tuple (Correction, 'Enabled', Enabled) + get_dict_tuple (Correction, 'Strength', Strength) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionEnabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionCorrectionStrength', Strength) + get_dict_tuple (ContrastDistortion, 'Removal', Removal) + get_dict_tuple (Removal, 'Enabled', Enabled) + get_dict_tuple (Removal, 'Threshold', Threshold) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalEnabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalContrastDistortionRemovalThreshold', Threshold) + + * Hole Filling Filter + get_dict_tuple (Experimental, 'HoleFilling', HoleFilling) + get_dict_tuple (HoleFilling, 'Enabled', Enabled) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingEnabled', Enabled) + get_dict_tuple (HoleFilling, 'HoleSize', HoleSize) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingHoleSize', HoleSize) + get_dict_tuple (HoleFilling, 'Strictness', Strictness) + set_framegrabber_param (AcqHandle, 'ProcessingFiltersExperimentalHoleFillingStrictness', Strictness) * Color Settings - get_dict_param(Processing, 'key_exists', 'Color', KeyExists) - if (KeyExists) - get_dict_tuple (Processing, 'Color', Color) - get_dict_tuple (Color, 'Balance', Balance) - get_dict_tuple (Balance, 'Blue', Blue) - get_dict_tuple (Balance, 'Green', Green) - get_dict_tuple (Balance, 'Red', Red) - set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceBlue', Blue) - set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceGreen', Green) - set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceRed', Red) - get_dict_tuple (Color, 'Experimental', Experimental) - get_dict_tuple (Experimental, 'Mode', Mode) - set_framegrabber_param (AcqHandle, 'ProcessingColorExperimentalMode', Mode) - else - NonExistingKeys := [NonExistingKeys, 'Color'] - endif - - tuple_length(NonExistingKeys, NumberOfNonExistingKeys) - if (NumberOfNonExistingKeys > 0) - dev_open_window (0, 0, 512, 512, 'black', WindowHandle) - DisplayText := 'Could not find the following capture settings:\n' - for Index := 0 to |NumberOfNonExistingKeys| - 1 by 1 - tuple_select(NonExistingKeys, Index, NonExistingKey) - DisplayText := DisplayText + '\t\t- ' + NonExistingKey + '\n' - endfor - DisplayText := DisplayText + 'Using default settings instead.' - dev_disp_text(DisplayText, 'window', 0, 0, 'red', ['box'], ['false']) - wait_seconds(5) - dev_close_window() - endif + get_dict_tuple (Processing, 'Color', Color) + get_dict_tuple (Color, 'Balance', Balance) + get_dict_tuple (Balance, 'Blue', Blue) + get_dict_tuple (Balance, 'Green', Green) + get_dict_tuple (Balance, 'Red', Red) + set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceBlue', Blue) + set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceGreen', Green) + set_framegrabber_param (AcqHandle, 'ProcessingColorBalanceRed', Red) + get_dict_tuple (Color, 'Experimental', Experimental) + get_dict_tuple (Experimental, 'Mode', Mode) + set_framegrabber_param (AcqHandle, 'ProcessingColorExperimentalMode', Mode) return () diff --git a/source/SampleUtils/convert_intrinsics_opencv_to_halcon.py b/source/SampleUtils/convert_intrinsics_opencv_to_halcon.py index a30759d..002af3d 100644 --- a/source/SampleUtils/convert_intrinsics_opencv_to_halcon.py +++ b/source/SampleUtils/convert_intrinsics_opencv_to_halcon.py @@ -20,8 +20,6 @@ GetCameraIntrinsics.cpp code sample from https://github.com/zivid/zivid-cpp-samples. An example YML file for this sample can be found under the main instructions for Zivid samples. -Note: This example uses experimental SDK features, which may be modified, moved, or deleted in the future without notice. - """ import argparse @@ -239,6 +237,14 @@ def from_file(cls, filepath: Path, model_name: str, sampling: str): if sampling in ["blueSubsample2x2", "redSubsample2x2"]: pixel_size *= 2 image_size = (image_size / 2).astype(np.int32) + elif model_name in [ + "zivid one", + "zivid one plus", + ]: + pixel_size = 5.86e-6 + image_size = np.array([np.int32(1920), np.int32(1200)]) + if sampling != "all": + raise ValueError(f"{sampling} is not supported for {model_name.title()}") return cls(pixel_size, image_size, intrinsics) @@ -264,8 +270,13 @@ def from_camera(cls, settings_path: Optional[Path] = None): if settings and settings.sampling.pixel in ["blueSubsample2x2", "redSubsample2x2"]: pixel_size *= 2 image_size = (image_size / 2).astype(np.int32) + elif "zividOne" in camera.info.model: + pixel_size = 5.86e-6 + image_size = np.array([np.int32(1920), np.int32(1200)]) + if settings and settings.sampling.pixel != "all": + raise ValueError(f"{settings.sampling.pixel} is not supported for {camera.info.model_name}") else: - raise RuntimeError("Unsupported camera model") + raise RuntimeError("Unsupported camera model in this sample") return cls(pixel_size, image_size, intrinsics) @@ -347,7 +358,7 @@ def _args() -> argparse.Namespace: parser.add_argument( "--model-name", type=str, - choices=["zivid 2", "zivid 2+"], + choices=["zivid one", "zivid one plus", "zivid 2", "zivid 2+"], required="--input-intrinsics" in sys.argv, help="Zivid camera model", )