From e0a41625c366bab5674010db198dbadec04adf63 Mon Sep 17 00:00:00 2001 From: builder Date: Mon, 30 Sep 2024 10:00:10 +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 | 26 +-- .../HandEyeCalibration/HandEyeCalibration.cs | 120 ++++--------- .../UtilizeHandEyeCalibration.cs | 38 ++-- .../MultiCameraCalibration.cs | 30 +--- .../Advanced/ROIBoxViaArucoMarker/App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../ROIBoxViaArucoMarker.cs | 166 ------------------ .../ROIBoxViaArucoMarker.csproj | 86 --------- .../ROIBoxViaArucoMarker/packages.config | 4 - .../Advanced/ROIBoxViaCheckerboard/App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../ROIBoxViaCheckerboard.cs | 154 ---------------- .../ROIBoxViaCheckerboard.csproj | 86 --------- .../ROIBoxViaCheckerboard/packages.config | 4 - ...nsformPointCloudFromMillimetersToMeters.cs | 4 +- .../App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../TransformPointCloudViaArucoMarker.cs | 58 ------ .../TransformPointCloudViaArucoMarker.csproj | 83 --------- .../TransformPointCloudViaCheckerboard.cs | 16 +- .../ProjectImageStartAndStop.cs | 8 +- .../ReadAndProjectImage.cs | 2 +- source/Applications/PointCloudTutorial.md | 31 ++-- .../Advanced/CaptureHDRLoop/CaptureHDRLoop.cs | 3 + .../CaptureAssistant/CaptureAssistant.cs | 4 +- .../CaptureFromFileCamera.cs | 4 +- .../CaptureHDRCompleteSettings.cs | 25 ++- source/Camera/Basic/CaptureTutorial.md | 64 +++---- .../CaptureWithSettingsFromYML.cs | 3 + .../App.config | 6 - ...AutomaticNetworkConfigurationForCameras.cs | 117 ------------ ...maticNetworkConfigurationForCameras.csproj | 85 --------- .../Properties/AssemblyInfo.cs | 35 ---- .../packages.config | 4 - .../CaptureWithDiagnostics.cs | 5 +- .../GetCameraIntrinsics.cs | 38 ++-- .../NetworkConfiguration/App.config | 6 - .../NetworkConfiguration.cs | 110 ------------ .../NetworkConfiguration.csproj | 82 --------- .../Properties/AssemblyInfo.cs | 35 ---- .../CorrectCameraInField/App.config | 6 - .../CorrectCameraInField.cs | 113 ------------ .../CorrectCameraInField.csproj | 77 -------- .../Properties/AssemblyInfo.cs | 35 ---- .../Maintenance/ResetCameraInField/App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../ResetCameraInField/ResetCameraInField.cs | 30 ---- .../ResetCameraInField.csproj | 77 -------- .../VerifyCameraInField/App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../VerifyCameraInField.cs | 58 ------ .../VerifyCameraInField.csproj | 79 --------- .../VerifyCameraInFieldFromZDF/App.config | 6 - .../Properties/AssemblyInfo.cs | 35 ---- .../VerifyCameraInFieldFromZDF.cs | 69 -------- .../VerifyCameraInFieldFromZDF.csproj | 77 -------- source/ZividNETSamples.sln | 59 +------ 57 files changed, 184 insertions(+), 2284 deletions(-) delete mode 100644 source/Applications/Advanced/ROIBoxViaArucoMarker/App.config delete mode 100644 source/Applications/Advanced/ROIBoxViaArucoMarker/Properties/AssemblyInfo.cs delete mode 100644 source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cs delete mode 100644 source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.csproj delete mode 100644 source/Applications/Advanced/ROIBoxViaArucoMarker/packages.config delete mode 100644 source/Applications/Advanced/ROIBoxViaCheckerboard/App.config delete mode 100644 source/Applications/Advanced/ROIBoxViaCheckerboard/Properties/AssemblyInfo.cs delete mode 100644 source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cs delete mode 100644 source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.csproj delete mode 100644 source/Applications/Advanced/ROIBoxViaCheckerboard/packages.config delete mode 100644 source/Applications/Advanced/TransformPointCloudViaArucoMarker/App.config delete mode 100644 source/Applications/Advanced/TransformPointCloudViaArucoMarker/Properties/AssemblyInfo.cs delete mode 100644 source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cs delete mode 100644 source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.csproj delete mode 100644 source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/App.config delete mode 100644 source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.cs delete mode 100644 source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.csproj delete mode 100644 source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/packages.config delete mode 100644 source/Camera/InfoUtilOther/NetworkConfiguration/App.config delete mode 100644 source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.cs delete mode 100644 source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.csproj delete mode 100644 source/Camera/InfoUtilOther/NetworkConfiguration/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/Maintenance/CorrectCameraInField/App.config delete mode 100644 source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cs delete mode 100644 source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.csproj delete mode 100644 source/Camera/Maintenance/CorrectCameraInField/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/Maintenance/ResetCameraInField/App.config delete mode 100644 source/Camera/Maintenance/ResetCameraInField/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cs delete mode 100644 source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.csproj delete mode 100644 source/Camera/Maintenance/VerifyCameraInField/App.config delete mode 100644 source/Camera/Maintenance/VerifyCameraInField/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cs delete mode 100644 source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.csproj delete mode 100644 source/Camera/Maintenance/VerifyCameraInFieldFromZDF/App.config delete mode 100644 source/Camera/Maintenance/VerifyCameraInFieldFromZDF/Properties/AssemblyInfo.cs delete mode 100644 source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cs delete mode 100644 source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.csproj diff --git a/README.md b/README.md index 5235272..aa516e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # C\# samples -This repository contains csharp code samples for Zivid SDK v2.13.1. For +This repository contains csharp 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-csharp-samples/tree/master/../../releases). @@ -62,9 +62,6 @@ from the camera can be used. - [CaptureHDRPrintNormals](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/Advanced/CaptureHDRPrintNormals/CaptureHDRPrintNormals.cs) - Capture Zivid point clouds, compute normals and print a subset. - **InfoUtilOther** - - [AutomaticNetworkConfigurationForCameras](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.cs) - Automatically set the IP addresses of any number of - cameras to be in the same subnet as the provided IP address - of the network interface. - [CameraInfo](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/CameraInfo/CameraInfo.cs) - List connected cameras and print camera version and state information for each connected camera. - [CameraUserData](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/CameraUserData/CameraUserData.cs) - Store user data on the Zivid camera. @@ -73,16 +70,8 @@ from the camera can be used. - [FirmwareUpdater](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/FirmwareUpdater/FirmwareUpdater.cs) - Update firmware on the Zivid camera. - [GetCameraIntrinsics](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs) - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud. - - [NetworkConfiguration](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.cs) - Uses Zivid API to change the IP address of the Zivid - camera. - [Warmup](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/InfoUtilOther/Warmup/Warmup.cs) - A basic warm-up method for a Zivid camera with specified time and capture cycle. - - **Maintenance** - - [CorrectCameraInField](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cs) - Correct the dimension trueness of a Zivid camera. - - [ResetCameraInField](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cs) - Reset infield correction on a camera. - - [VerifyCameraInField](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cs) - Check the dimension trueness of a Zivid camera. - - [VerifyCameraInFieldFromZDF](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cs) - Check the dimension trueness of a Zivid camera from a ZDF - file. - **Applications** - **Basic** - **Visualization** @@ -102,14 +91,7 @@ from the camera can be used. - [HandEyeCalibration](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cs) - Perform Hand-Eye calibration. - [MultiCameraCalibration](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/MultiCameraCalibration/MultiCameraCalibration.cs) - Use captures of a calibration object to generate transformation matrices to a single coordinate frame. - - [ROIBoxViaArucoMarker](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cs) - 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-csharp-samples/tree/master/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cs) - Filter the point cloud based on a ROI box given relative - to the Zivid Calibration Board. - [TransformPointCloudFromMillimetersToMeters](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs) - Transform point cloud data from millimeters to meters. - - [TransformPointCloudViaArucoMarker](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cs) - Transform a point cloud from camera to ArUco marker - coordinate frame by estimating the marker's pose from the - point cloud. - [TransformPointCloudViaCheckerboard](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cs) - Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API. @@ -117,7 +99,7 @@ from the camera can be used. - [PoseConversions](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/PoseConversions/PoseConversions.cs) - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector) - [UtilizeHandEyeCalibration](https://github.com/zivid/zivid-csharp-samples/tree/master/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cs) - Transform single data point or entire point cloud from - camera to robot base reference frame using Hand-Eye + camera frame to robot base frame using Hand-Eye calibration ## Installation @@ -143,8 +125,8 @@ Visual Studio](https://support.zivid.com/latest/api-reference/samples/csharp/build-c-sharp-samples-using-visual-studio.html). Some of the samples depend on external libraries, in particular -`MathNet.Numerics` and `System.ValueTuple`. These libraries will be -installed automatically through NuGet when building the sample. +`MathNet.Numerics`. These libraries will be installed automatically +through NuGet when building the sample. ## Support diff --git a/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cs b/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cs index f2cf128..e52bea0 100644 --- a/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cs +++ b/source/Applications/Advanced/HandEyeCalibration/HandEyeCalibration/HandEyeCalibration.cs @@ -6,6 +6,7 @@ Perform Hand-Eye calibration. using System.Collections.Generic; using System.IO; using System.Linq; + using Zivid.NET.Calibration; using Duration = Zivid.NET.Duration; @@ -24,13 +25,9 @@ static int Main() var calibrationResult = performCalibration(handEyeInput); - Console.WriteLine("Zivid primarily operates with a (4x4) transformation matrix. To convert"); - Console.WriteLine("to axis-angle, rotation vector, roll-pitch-yaw, or quaternion, check out"); - Console.WriteLine("our PoseConversions sample."); - if (calibrationResult.Valid()) { - Console.WriteLine("{0}\n{1}\n{2}", "Hand-Eye calibration OK", "Result: ", calibrationResult); + Console.WriteLine("{0}\n{1}\n{2}", "Hand-Eye calibration OK", "Result:", calibrationResult); } else { @@ -52,26 +49,8 @@ static List readHandEyeInputs(Zivid.NET.Camera camera) var currentPoseId = 0U; var beingInput = true; - var calibrationObject = ""; - while (true) - { - Console.WriteLine("Enter calibration object you are using, m (for ArUco marker(s)) or c (for Zivid checkerboard): "); - calibrationObject = Console.ReadLine(); - - if (calibrationObject.Equals("m", StringComparison.CurrentCultureIgnoreCase) || - calibrationObject.Equals("c", StringComparison.CurrentCultureIgnoreCase)) - { - break; - } - } - - Interaction.ExtendInputBuffer(2048); - Console.WriteLine("Zivid primarily operates with a (4x4) transformation matrix. To convert"); - Console.WriteLine("from axis-angle, rotation vector, roll-pitch-yaw, or quaternion, check out"); - Console.WriteLine("our PoseConversions sample."); - do { switch (Interaction.EnterCommand()) @@ -79,7 +58,23 @@ static List readHandEyeInputs(Zivid.NET.Camera camera) case CommandType.AddPose: try { - HandleAddPose(ref currentPoseId, ref handEyeInput, camera, calibrationObject); + var robotPose = Interaction.EnterRobotPose(currentPoseId); + using (var frame = Interaction.AssistedCapture(camera)) + { + Console.Write("Detecting checkerboard in point cloud: "); + var detectionResult = Detector.DetectFeaturePoints(frame.PointCloud); + + if (detectionResult.Valid()) + { + Console.WriteLine("Calibration board detected"); + handEyeInput.Add(new HandEyeInput(robotPose, detectionResult)); + ++currentPoseId; + } + else + { + Console.WriteLine("Failed to detect calibration board, ensure that the entire board is in the view of the camera"); + } + } } catch (Exception ex) { @@ -96,82 +91,25 @@ static List readHandEyeInputs(Zivid.NET.Camera camera) return handEyeInput; } - public static void HandleAddPose(ref uint currentPoseId, ref List handEyeInput, Zivid.NET.Camera camera, string calibrationObject) - { - var robotPose = Interaction.EnterRobotPose(currentPoseId); - - Console.Write("Detecting calibration object in point cloud"); - if (calibrationObject.Equals("c", StringComparison.CurrentCultureIgnoreCase)) - { - var frame = Zivid.NET.Calibration.Detector.CaptureCalibrationBoard(camera); - var detectionResult = Detector.DetectCalibrationBoard(frame); - - if (detectionResult.Valid()) - { - Console.WriteLine("Calibration board detected"); - handEyeInput.Add(new HandEyeInput(robotPose, detectionResult)); - ++currentPoseId; - } - else - { - Console.WriteLine("Failed to detect calibration board, ensure that the entire board is in the view of the camera"); - } - } - else if (calibrationObject.Equals("m", StringComparison.CurrentCultureIgnoreCase)) - { - var frame = AssistedCapture(camera); - - var markerDictionary = Zivid.NET.MarkerDictionary.Aruco4x4_50; - var markerIds = new List { 1, 2, 3 }; - - Console.WriteLine("Detecting arUco marker IDs " + string.Join(", ", markerIds)); - var detectionResult = Detector.DetectMarkers(frame, markerIds, markerDictionary); - - if (detectionResult.Valid()) - { - Console.WriteLine("ArUco marker(s) detected: " + detectionResult.DetectedMarkers().Length); - handEyeInput.Add(new HandEyeInput(robotPose, detectionResult)); - ++currentPoseId; - } - else - { - Console.WriteLine("Failed to detect any ArUco markers, ensure that at least one ArUco marker is in the view of the camera"); - } - } - } - static Zivid.NET.Calibration.HandEyeOutput performCalibration(List handEyeInput) { while (true) { - Console.WriteLine("Enter type of calibration, eth (for eye-to-hand) or eih (for eye-in-hand): "); + Console.WriteLine("Enter type of calibration, eth (for eye-to-hand) or eih (for eye-in-hand):"); var calibrationType = Console.ReadLine(); if (calibrationType.Equals("eth", StringComparison.CurrentCultureIgnoreCase)) { - Console.WriteLine("Performing eye-to-hand calibration with " + handEyeInput.Count + " dataset pairs"); - Console.WriteLine("The resulting transform is the camera pose in robot base frame"); + Console.WriteLine("Performing eye-to-hand calibration"); return Calibrator.CalibrateEyeToHand(handEyeInput); } if (calibrationType.Equals("eih", StringComparison.CurrentCultureIgnoreCase)) { - Console.WriteLine("Performing eye-in-hand calibration with " + handEyeInput.Count + " dataset pairs"); - Console.WriteLine("The resulting transform is the camera pose in flange (end-effector) frame"); + Console.WriteLine("Performing eye-in-hand calibration"); return Calibrator.CalibrateEyeInHand(handEyeInput); } Console.WriteLine("Entered unknown method"); } } - public static Zivid.NET.Frame AssistedCapture(Zivid.NET.Camera camera) - { - var suggestSettingsParameters = new Zivid.NET.CaptureAssistant.SuggestSettingsParameters - { - AmbientLightFrequency = - Zivid.NET.CaptureAssistant.SuggestSettingsParameters.AmbientLightFrequencyOption.none, - MaxCaptureTime = Duration.FromMilliseconds(800) - }; - var settings = Zivid.NET.CaptureAssistant.Assistant.SuggestSettings(camera, suggestSettingsParameters); - return camera.Capture(settings); - } } enum CommandType @@ -192,7 +130,7 @@ public static void ExtendInputBuffer(int size) public static CommandType EnterCommand() { - Console.Write("Enter command, p (to add robot pose) or c (to perform calibration): "); + Console.Write("Enter command, p (to add robot pose) or c (to perform calibration):"); var command = Console.ReadLine().ToLower(); switch (command) @@ -217,4 +155,16 @@ public static Pose EnterRobotPose(ulong index) var robotPose = new Pose(elements); Console.WriteLine("The following pose was entered: \n{0}", robotPose); return robotPose; } + + public static Zivid.NET.Frame AssistedCapture(Zivid.NET.Camera camera) + { + var suggestSettingsParameters = new Zivid.NET.CaptureAssistant.SuggestSettingsParameters + { + AmbientLightFrequency = + Zivid.NET.CaptureAssistant.SuggestSettingsParameters.AmbientLightFrequencyOption.none, + MaxCaptureTime = Duration.FromMilliseconds(800) + }; + var settings = Zivid.NET.CaptureAssistant.Assistant.SuggestSettings(camera, suggestSettingsParameters); + return camera.Capture(settings); + } } diff --git a/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cs b/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cs index 6559bba..35e097e 100644 --- a/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cs +++ b/source/Applications/Advanced/HandEyeCalibration/UtilizeHandEyeCalibration/UtilizeHandEyeCalibration.cs @@ -1,25 +1,25 @@ /* -Transform single data point or entire point cloud from camera to robot base reference frame using Hand-Eye calibration +Transform single data point or entire point cloud from camera frame to robot base frame using Hand-Eye calibration matrix. This example shows how to utilize the result of Hand-Eye calibration to transform either (picking) point coordinates -or the entire point cloud from the camera to the robot base reference frame. +or the entire point cloud from the camera frame to the robot base frame. For both Eye-To-Hand and Eye-In-Hand, there is a Zivid gem placed approx. 500 mm away from the robot base (see below). -The (picking) point is the Zivid gem centroid, defined as image coordinates in the camera reference frame and hard-coded +The (picking) point is the Zivid gem centroid, defined as image coordinates in the camera frame and hard-coded in this code example. Open the ZDF files in Zivid Studio to inspect the gem's 2D and corresponding 3D coordinates. Eye-To-Hand - ZDF file: ZividGemEyeToHand.zdf - 2D image coordinates: (1035,255) - Corresponding 3D coordinates: (37.77 -145.92 1227.1) -- Corresponding 3D coordinates (robot base reference frame): (-12.4 514.37 -21.79) +- Corresponding 3D coordinates (robot base frame): (-12.4 514.37 -21.79) Eye-In-Hand: - ZDF file: ZividGemEyeInHand.zdf - 2D image coordinates: (1460,755) -- Corresponding 3D coordinates (camera reference frame): (83.95 28.84 305.7) -- Corresponding 3D coordinates (robot base reference frame): (531.03 -5.44 164.6) +- Corresponding 3D coordinates (camera frame): (83.95 28.84 305.7) +- Corresponding 3D coordinates (robot base frame): (531.03 -5.44 164.6) For verification, check that the Zivid gem centroid 3D coordinates are the same as above after the transformation. @@ -52,14 +52,14 @@ static int Main() fileName = "ZividGemEyeToHand.zdf"; - // The (picking) point is defined as image coordinates in camera reference frame. It is hard-coded - // for the ZividGemEyeToHand.zdf (1035,255) X: 37.8 Y: -145.9 Z: 1227.1 + // The (picking) point is defined as image coordinates in camera frame. It is hard-coded for the + // ZividGemEyeToHand.zdf (1035,255) X: 37.8 Y: -145.9 Z: 1227.1 imageCoordinateX = 1035; imageCoordinateY = 255; var eyeToHandTransformFile = "EyeToHandTransform.yaml"; - Console.WriteLine("Reading camera pose in robot base reference frame (result of eye-to-hand calibration"); + Console.WriteLine("Reading camera pose in robot base frame (result of eye-to-hand calibration"); var eyeToHandTransform = new Zivid.NET.Matrix4x4( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/" + eyeToHandTransformFile); @@ -74,8 +74,8 @@ static int Main() fileName = "ZividGemEyeInHand.zdf"; - // The (picking) point is defined as image coordinates in camera reference frame. It is hard-coded - // for the ZividGemEyeInHand.zdf (1460,755) X: 83.95 Y: 28.84 Z: 305.7 + // The (picking) point is defined as image coordinates in camera frame. It is hard-coded for the + // ZividGemEyeInHand.zdf (1460,755) X: 83.95 Y: 28.84 Z: 305.7 imageCoordinateX = 1357; imageCoordinateY = 666; @@ -83,12 +83,12 @@ static int Main() var robotTransformFile = "RobotTransform.yaml"; Console.WriteLine( - "Reading camera pose in end-effector reference frame (result of eye-in-hand calibration)"); + "Reading camera pose in end-effector frame (result of eye-in-hand calibration)"); var eyeInHandTransform = new Zivid.NET.Matrix4x4( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/" + eyeInHandTransformFile); - Console.WriteLine("Reading end-effector pose in robot base reference frame"); + Console.WriteLine("Reading end-effector pose in robot base frame"); var robotTransform = new Zivid.NET.Matrix4x4( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/" + robotTransformFile); @@ -97,7 +97,7 @@ static int Main() Matrix transformEndEffectorToCamera = zividToMathDotNet(eyeInHandTransform); Matrix transformBaseToEndEffector = zividToMathDotNet(robotTransform); - Console.WriteLine("Computing camera pose in robot base reference frame"); + Console.WriteLine("Computing camera pose in robot base frame"); transformBaseToCameraMath = transformBaseToEndEffector * transformEndEffectorToCamera; loopContinue = false; @@ -111,7 +111,7 @@ static int Main() var dataFile = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/" + fileName; - Console.WriteLine("Reading point cloud from file: " + dataFile); + Console.WriteLine("Reading ZDF frame from file: " + dataFile); var frame = new Zivid.NET.Frame(dataFile); var pointCloud = frame.PointCloud; @@ -132,12 +132,12 @@ static int Main() xyz[imageCoordinateY, imageCoordinateX, 3] }; Vector pointInCameraFrame = CreateVector.DenseOfArray(pickingPoint); - Console.WriteLine("Point coordinates in camera reference frame: " + pointInCameraFrame); + Console.WriteLine("Point coordinates in camera frame: " + pointInCameraFrame); - Console.WriteLine("Transforming (picking) point from camera to robot base reference frame"); + Console.WriteLine("Transforming (picking) point from camera to robot base frame"); Vector pointInBaseFrame = transformBaseToCameraMath * pointInCameraFrame; - Console.WriteLine("Point coordinates in robot base reference frame: " + pointInBaseFrame); + Console.WriteLine("Point coordinates in robot base frame: " + pointInBaseFrame); loopContinue = false; break; @@ -150,7 +150,7 @@ static int Main() pointCloud.Transform(transformBaseToCamera); var saveFile = "ZividGemTransformed.zdf"; - Console.WriteLine("Saving point cloud to file: " + saveFile); + Console.WriteLine("Saving frame to file: " + saveFile); frame.Save(saveFile); loopContinue = false; diff --git a/source/Applications/Advanced/MultiCameraCalibration/MultiCameraCalibration.cs b/source/Applications/Advanced/MultiCameraCalibration/MultiCameraCalibration.cs index 070be0c..9471c8f 100644 --- a/source/Applications/Advanced/MultiCameraCalibration/MultiCameraCalibration.cs +++ b/source/Applications/Advanced/MultiCameraCalibration/MultiCameraCalibration.cs @@ -18,18 +18,22 @@ static int Main() var zivid = new Zivid.NET.Application(); var cameras = zivid.Cameras; Console.WriteLine("Number of cameras found: {0}", cameras.Count); - var connectedCameras = connectToAllAvailableCameras(cameras); + foreach (var camera in cameras) + { + Console.WriteLine("Connecting to camera: {0}", camera.Info.SerialNumber); + camera.Connect(); + } var detectionResults = new List(); var serialNumbers = new List(); - foreach (var camera in connectedCameras) + foreach (var camera in cameras) { var serialNumber = camera.Info.SerialNumber.ToString(); Console.WriteLine("Capturing frame with camera: {0}", serialNumber); using (var frame = AssistedCapture(camera)) { Console.WriteLine("Detecting checkerboard in point cloud"); - var detectionResult = Detector.DetectCalibrationBoard(frame); + var detectionResult = Detector.DetectFeaturePoints(frame.PointCloud); if (detectionResult) { detectionResults.Add(detectionResult); @@ -83,26 +87,6 @@ static Zivid.NET.Frame AssistedCapture(Zivid.NET.Camera camera) return camera.Capture(settings); } - static List connectToAllAvailableCameras(IList cameras) - { - var connectedCameras = new List(); - foreach (var camera in cameras) - { - if (camera.State.Status == Zivid.NET.CameraState.StatusOption.Available) - { - Console.WriteLine("Connecting to camera: {0}", camera.Info.SerialNumber); - camera.Connect(); - connectedCameras.Add(camera); - } - else - { - Console.WriteLine("Unable to connect to camera: {0}. ", camera.Info.SerialNumber); - Console.WriteLine("Camera status: {0}.", camera.State.Status); - } - } - return connectedCameras; - } - static void PrintMatrix(float[,] matrix) { var lineSep = new String('-', 50); diff --git a/source/Applications/Advanced/ROIBoxViaArucoMarker/App.config b/source/Applications/Advanced/ROIBoxViaArucoMarker/App.config deleted file mode 100644 index 7eb8d24..0000000 --- a/source/Applications/Advanced/ROIBoxViaArucoMarker/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Applications/Advanced/ROIBoxViaArucoMarker/Properties/AssemblyInfo.cs b/source/Applications/Advanced/ROIBoxViaArucoMarker/Properties/AssemblyInfo.cs deleted file mode 100644 index a15ed32..0000000 --- a/source/Applications/Advanced/ROIBoxViaArucoMarker/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("ROIBoxViaArucoMarker")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ROIBoxViaArucoMarker")] -[assembly: AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("96CC8163-6D2F-4FF9-B89C-FD2A137AC672")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cs b/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cs deleted file mode 100644 index a27ba51..0000000 --- a/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.cs +++ /dev/null @@ -1,166 +0,0 @@ -/* -Filter the point cloud based on a ROI box given relative to the ArUco marker on a Zivid Calibration Board. - -The ZFC file for this sample can be downloaded from https://support.zivid.com/en/latest/api-reference/samples/sample-data.html. -*/ - -using System; -using System.Collections.Generic; -using Zivid.NET; -using Zivid.NET.Calibration; - -using MathNet.Numerics.LinearAlgebra; -using MathNet.Numerics.LinearAlgebra.Double; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - string fileCamera = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/BinWithCalibrationBoard.zfc"; - - Console.WriteLine("Creating virtual camera using file: " + fileCamera); - var camera = zivid.CreateFileCamera(fileCamera); - - var settings = new Zivid.NET.Settings - { - Acquisitions = { new Zivid.NET.Settings.Acquisition { } } - }; - - var originalFrame = camera.Capture(settings); - var pointCloud = originalFrame.PointCloud; - - Console.WriteLine("Displaying the original point cloud"); - VisualizeZividPointCloud(originalFrame); - - Console.WriteLine("Configuring ROI box based on bin size and checkerboard placement"); - float roiBoxLength = 545F; - float roiBoxWidth = 345F; - float roiBoxHeight = 150F; - - // Coordinates are relative to the checkerboard origin which lies in the intersection between the four checkers - // in the top-left corner of the checkerboard: Positive x-axis is "East", y-axis is "South" and z-axis is "Down" - var roiBoxLowerRightCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = 240F, - y = 30F, - z = 5F - }; - var roiBoxUpperRightCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = roiBoxLowerRightCornerInCheckerboardFrame.x, - y = roiBoxLowerRightCornerInCheckerboardFrame.y - roiBoxWidth, - z = roiBoxLowerRightCornerInCheckerboardFrame.z - }; - var roiBoxLowerLeftCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = roiBoxLowerRightCornerInCheckerboardFrame.x - roiBoxLength, - y = roiBoxLowerRightCornerInCheckerboardFrame.y, - z = roiBoxLowerRightCornerInCheckerboardFrame.z - - }; - - var pointOInCheckerboardFrame = roiBoxLowerRightCornerInCheckerboardFrame; - var pointAInCheckerboardFrame = roiBoxUpperRightCornerInCheckerboardFrame; - var pointBInCheckerboardFrame = roiBoxLowerLeftCornerInCheckerboardFrame; - - Console.WriteLine("Configuring ArUco marker"); - var markerDictionary = Zivid.NET.MarkerDictionary.Aruco4x4_50; - var markerId = new List { 1 }; - - Console.WriteLine("Detecting ArUco marker"); - var detectionResult = Detector.DetectMarkers(originalFrame, markerId, markerDictionary); - - if (!detectionResult.Valid()) - { - Console.WriteLine("No ArUco markers detected"); - return 1; - } - - Console.WriteLine("Estimating pose of detected ArUco marker"); - var cameraToMarkerTransform = new Zivid.NET.Matrix4x4(detectionResult.DetectedMarkers()[0].Pose().ToMatrix()); - - Console.WriteLine("Transforming the ROI base frame points to the camera frame"); - var roiPointsInCameraFrame = TransformPoints( - new List { pointOInCheckerboardFrame, pointAInCheckerboardFrame, pointBInCheckerboardFrame }, - cameraToMarkerTransform); - - Console.WriteLine("Setting the ROI"); - settings.RegionOfInterest.Box.Enabled = true; - settings.RegionOfInterest.Box.PointO = roiPointsInCameraFrame[0]; - settings.RegionOfInterest.Box.PointA = roiPointsInCameraFrame[1]; - settings.RegionOfInterest.Box.PointB = roiPointsInCameraFrame[2]; - settings.RegionOfInterest.Box.Extents = new Zivid.NET.Range(-10, roiBoxHeight); - - var roiFrame = camera.Capture(settings); - - Console.WriteLine("Displaying the ROI-filtered point cloud"); - VisualizeZividPointCloud(roiFrame); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } - static void VisualizeZividPointCloud(Zivid.NET.Frame frame) - { - using (var visualizer = new Zivid.NET.Visualization.Visualizer()) - { - visualizer.Show(frame); - visualizer.ShowMaximized(); - visualizer.ResetToFit(); - Console.WriteLine("Running visualizer. Blocking until window closes."); - visualizer.Run(); - } - } - - static List> ZividToMathDotNet(List zividPoints) - { - var mathDotNetPoints = new List>(zividPoints.Count); - foreach (var point in zividPoints) - { - mathDotNetPoints.Add(CreateMatrix.DenseOfArray(new double[,] { { point.x }, { point.y }, { point.z } })); - } - return mathDotNetPoints; - } - - static Matrix ZividToMathDotNet(Matrix4x4 zividMatrix) - { - return CreateMatrix.DenseOfArray(zividMatrix.ToArray()).ToDouble(); - } - - public static List MathDotNetToZivid(List> mathDotNetPoints) - { - var zividPoints = new List(mathDotNetPoints.Count); - foreach (var point in mathDotNetPoints) - { - var zividPoint = new PointXYZ - { - x = (float)point[0, 0], - y = (float)point[1, 0], - z = (float)point[2, 0] - }; - zividPoints.Add(zividPoint); - } - return zividPoints; - } - static List TransformPoints(List zividPoints, Matrix4x4 zividTransform) - { - var mathDotNetPoints = ZividToMathDotNet(zividPoints); - var mathDotNetTransform = ZividToMathDotNet(zividTransform); - - var transformedMathDotNetPoints = new List>(mathDotNetPoints.Count); - for (int i = 0; i < mathDotNetPoints.Count; i++) - { - var transformedPoint = mathDotNetTransform.SubMatrix(0, 3, 0, 3) * mathDotNetPoints[i] + mathDotNetTransform.SubMatrix(0, 3, 3, 1); - transformedMathDotNetPoints.Add(transformedPoint); - } - - return MathDotNetToZivid(transformedMathDotNetPoints); - } -} diff --git a/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.csproj b/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.csproj deleted file mode 100644 index 8bbe7dc..0000000 --- a/source/Applications/Advanced/ROIBoxViaArucoMarker/ROIBoxViaArucoMarker.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Debug - AnyCPU - {96CC8163-6D2F-4FF9-B89C-FD2A137AC672} - Exe - ROIBoxViaArucoMarker - ROIBoxViaArucoMarker - v4.6.1 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE - prompt - 4 - true - - - - ..\..\..\packages\MathNet.Numerics.4.12.0\lib\net461\MathNet.Numerics.dll - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividVisualizationNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividVisualizationNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Applications/Advanced/ROIBoxViaArucoMarker/packages.config b/source/Applications/Advanced/ROIBoxViaArucoMarker/packages.config deleted file mode 100644 index ed08549..0000000 --- a/source/Applications/Advanced/ROIBoxViaArucoMarker/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/Applications/Advanced/ROIBoxViaCheckerboard/App.config b/source/Applications/Advanced/ROIBoxViaCheckerboard/App.config deleted file mode 100644 index 7eb8d24..0000000 --- a/source/Applications/Advanced/ROIBoxViaCheckerboard/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Applications/Advanced/ROIBoxViaCheckerboard/Properties/AssemblyInfo.cs b/source/Applications/Advanced/ROIBoxViaCheckerboard/Properties/AssemblyInfo.cs deleted file mode 100644 index 7c4e529..0000000 --- a/source/Applications/Advanced/ROIBoxViaCheckerboard/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("ROIBoxViaCheckerboard")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ROIBoxViaCheckerboard")] -[assembly: AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("FDAE54C3-5924-462B-BCE9-E8C51CB637B3")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cs b/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cs deleted file mode 100644 index 2f0db63..0000000 --- a/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.cs +++ /dev/null @@ -1,154 +0,0 @@ -/* -Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board. - -The ZFC file for this sample can be downloaded from https://support.zivid.com/en/latest/api-reference/samples/sample-data.html. -*/ - -using System; -using System.Collections.Generic; -using Zivid.NET; -using Zivid.NET.Calibration; - -using MathNet.Numerics.LinearAlgebra; -using MathNet.Numerics.LinearAlgebra.Double; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - string fileCamera = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/BinWithCalibrationBoard.zfc"; - - Console.WriteLine("Creating virtual camera using file: " + fileCamera); - var camera = zivid.CreateFileCamera(fileCamera); - - var settings = new Zivid.NET.Settings - { - Acquisitions = { new Zivid.NET.Settings.Acquisition { } } - }; - - var originalFrame = camera.Capture(settings); - var pointCloud = originalFrame.PointCloud; - - Console.WriteLine("Displaying the original point cloud"); - VisualizeZividPointCloud(originalFrame); - - Console.WriteLine("Configuring ROI box based on bin size and checkerboard placement"); - float roiBoxLength = 545F; - float roiBoxWidth = 345F; - float roiBoxHeight = 150F; - - // Coordinates are relative to the checkerboard origin which lies in the intersection between the four checkers - // in the top-left corner of the checkerboard: Positive x-axis is "East", y-axis is "South" and z-axis is "Down" - var roiBoxLowerRightCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = 240F, - y = 260F, - z = 5F - }; - var roiBoxUpperRightCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = roiBoxLowerRightCornerInCheckerboardFrame.x, - y = roiBoxLowerRightCornerInCheckerboardFrame.y - roiBoxWidth, - z = roiBoxLowerRightCornerInCheckerboardFrame.z - }; - var roiBoxLowerLeftCornerInCheckerboardFrame = new Zivid.NET.PointXYZ - { - x = roiBoxLowerRightCornerInCheckerboardFrame.x - roiBoxLength, - y = roiBoxLowerRightCornerInCheckerboardFrame.y, - z = roiBoxLowerRightCornerInCheckerboardFrame.z - - }; - - var pointOInCheckerboardFrame = roiBoxLowerRightCornerInCheckerboardFrame; - var pointAInCheckerboardFrame = roiBoxUpperRightCornerInCheckerboardFrame; - var pointBInCheckerboardFrame = roiBoxLowerLeftCornerInCheckerboardFrame; - - Console.WriteLine("Detecting and estimating pose of the Zivid checkerboard in the camera frame"); - var detectionResult = Detector.DetectCalibrationBoard(originalFrame); - var cameraToCheckerboardTransform = new Zivid.NET.Matrix4x4(detectionResult.Pose().ToMatrix()); - - Console.WriteLine("Transforming the ROI base frame points to the camera frame"); - var roiPointsInCameraFrame = TransformPoints( - new List { pointOInCheckerboardFrame, pointAInCheckerboardFrame, pointBInCheckerboardFrame }, - cameraToCheckerboardTransform); - - Console.WriteLine("Setting the ROI"); - settings.RegionOfInterest.Box.Enabled = true; - settings.RegionOfInterest.Box.PointO = roiPointsInCameraFrame[0]; - settings.RegionOfInterest.Box.PointA = roiPointsInCameraFrame[1]; - settings.RegionOfInterest.Box.PointB = roiPointsInCameraFrame[2]; - settings.RegionOfInterest.Box.Extents = new Zivid.NET.Range(-10, roiBoxHeight); - - var roiFrame = camera.Capture(settings); - - Console.WriteLine("Displaying the ROI-filtered point cloud"); - VisualizeZividPointCloud(roiFrame); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } - static void VisualizeZividPointCloud(Zivid.NET.Frame frame) - { - using (var visualizer = new Zivid.NET.Visualization.Visualizer()) - { - visualizer.Show(frame); - visualizer.ShowMaximized(); - visualizer.ResetToFit(); - Console.WriteLine("Running visualizer. Blocking until window closes."); - visualizer.Run(); - } - } - - static List> ZividToMathDotNet(List zividPoints) - { - var mathDotNetPoints = new List>(zividPoints.Count); - foreach (var point in zividPoints) - { - mathDotNetPoints.Add(CreateMatrix.DenseOfArray(new double[,] { { point.x }, { point.y }, { point.z } })); - } - return mathDotNetPoints; - } - - static Matrix ZividToMathDotNet(Matrix4x4 zividMatrix) - { - return CreateMatrix.DenseOfArray(zividMatrix.ToArray()).ToDouble(); - } - - public static List MathDotNetToZivid(List> mathDotNetPoints) - { - var zividPoints = new List(mathDotNetPoints.Count); - foreach (var point in mathDotNetPoints) - { - var zividPoint = new PointXYZ - { - x = (float)point[0, 0], - y = (float)point[1, 0], - z = (float)point[2, 0] - }; - zividPoints.Add(zividPoint); - } - return zividPoints; - } - static List TransformPoints(List zividPoints, Matrix4x4 zividTransform) - { - var mathDotNetPoints = ZividToMathDotNet(zividPoints); - var mathDotNetTransform = ZividToMathDotNet(zividTransform); - - var transformedMathDotNetPoints = new List>(mathDotNetPoints.Count); - for (int i = 0; i < mathDotNetPoints.Count; i++) - { - var transformedPoint = mathDotNetTransform.SubMatrix(0, 3, 0, 3) * mathDotNetPoints[i] + mathDotNetTransform.SubMatrix(0, 3, 3, 1); - transformedMathDotNetPoints.Add(transformedPoint); - } - - return MathDotNetToZivid(transformedMathDotNetPoints); - } -} diff --git a/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.csproj b/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.csproj deleted file mode 100644 index 9b620b8..0000000 --- a/source/Applications/Advanced/ROIBoxViaCheckerboard/ROIBoxViaCheckerboard.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Debug - AnyCPU - {FDAE54C3-5924-462B-BCE9-E8C51CB637B3} - Exe - ROIBoxViaCheckerboard - ROIBoxViaCheckerboard - v4.6.1 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE - prompt - 4 - true - - - - ..\..\..\packages\MathNet.Numerics.4.12.0\lib\net461\MathNet.Numerics.dll - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividVisualizationNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividVisualizationNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Applications/Advanced/ROIBoxViaCheckerboard/packages.config b/source/Applications/Advanced/ROIBoxViaCheckerboard/packages.config deleted file mode 100644 index ed08549..0000000 --- a/source/Applications/Advanced/ROIBoxViaCheckerboard/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs b/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs index 3f3825e..c5e3d23 100644 --- a/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs +++ b/source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs @@ -20,11 +20,11 @@ static int Main() var frame = new Zivid.NET.Frame(dataFile); var pointCloud = frame.PointCloud; - var millimetersToMetersTransform = + var transformMillimetersToMeters = new float[,] { { 0.001F, 0, 0, 0 }, { 0, 0.001F, 0, 0 }, { 0, 0, 0.001F, 0 }, { 0, 0, 0, 1 } }; Console.WriteLine("Transforming point cloud from mm to m"); - pointCloud.Transform(millimetersToMetersTransform); + pointCloud.Transform(transformMillimetersToMeters); var transformedFile = "FrameInMeters.zdf"; Console.WriteLine("Saving frame to file: " + transformedFile); diff --git a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/App.config b/source/Applications/Advanced/TransformPointCloudViaArucoMarker/App.config deleted file mode 100644 index 1ab2984..0000000 --- a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/Properties/AssemblyInfo.cs b/source/Applications/Advanced/TransformPointCloudViaArucoMarker/Properties/AssemblyInfo.cs deleted file mode 100644 index d9ab936..0000000 --- a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("TransformPointCloudViaArucoMarker")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TransformPointCloudViaArucoMarker")] -[assembly: AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2F721053-DE2A-4714-853C-CDDBB5828AB0")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cs b/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cs deleted file mode 100644 index d85aa4f..0000000 --- a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -Transform a point cloud from camera to ArUco marker coordinate frame by estimating the marker's pose from the point cloud. - -The ZDF file for this sample can be found under the main instructions for Zivid samples. -*/ - -using System; -using Zivid.NET.Calibration; -using System.Collections.Generic; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - var calibrationBoardFile = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) - + "/Zivid/CalibrationBoardInCameraOrigin.zdf"; - Console.WriteLine("Reading ZDF frame from file: " + calibrationBoardFile); - var frame = new Zivid.NET.Frame(calibrationBoardFile); - var pointCloud = frame.PointCloud; - - Console.WriteLine("Configuring ArUco marker"); - var markerDictionary = Zivid.NET.MarkerDictionary.Aruco4x4_50; - var markerId = new List { 1 }; - - Console.WriteLine("Detecting ArUco marker"); - var detectionResult = Detector.DetectMarkers(frame, markerId, markerDictionary); - - Console.WriteLine("Estimating pose of detected ArUco marker"); - var cameraToMarkerTransform = new Zivid.NET.Matrix4x4(detectionResult.DetectedMarkers()[0].Pose().ToMatrix()); - Console.WriteLine("ArUco marker pose in camera frame:"); - Console.WriteLine(cameraToMarkerTransform); - Console.WriteLine("Camera pose in ArUco marker frame:"); - var markerToCameraTransform = cameraToMarkerTransform.Inverse(); - Console.WriteLine(markerToCameraTransform); - - var transformFile = "ArUcoMarkerToCameraTransform.yaml"; - Console.WriteLine("Saving a YAML file with Inverted ArUco marker pose to file: " + transformFile); - markerToCameraTransform.Save(transformFile); - - Console.WriteLine("Transforming point cloud from camera frame to ArUco marker frame"); - pointCloud.Transform(markerToCameraTransform); - - var arucoMarkerTransformedFile = "CalibrationBoardInArucoMarkerOrigin.zdf"; - Console.WriteLine("Saving transformed point cloud to file: " + arucoMarkerTransformedFile); - frame.Save(arucoMarkerTransformedFile); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} diff --git a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.csproj b/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.csproj deleted file mode 100644 index ee4ab8d..0000000 --- a/source/Applications/Advanced/TransformPointCloudViaArucoMarker/TransformPointCloudViaArucoMarker.csproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Debug - AnyCPU - {2F721053-DE2A-4714-853C-CDDBB5828AB0} - Exe - TransformPointCloudViaArucoMarker - TransformPointCloudViaArucoMarker - v4.5.2 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE - prompt - 4 - true - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividVisualizationNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividVisualizationNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cs b/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cs index af5ba9a..70183f0 100644 --- a/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cs +++ b/source/Applications/Advanced/TransformPointCloudViaCheckerboard/TransformPointCloudViaCheckerboard.cs @@ -23,19 +23,15 @@ static int Main() var pointCloud = frame.PointCloud; Console.WriteLine("Detecting and estimating pose of the Zivid checkerboard in the camera frame"); - var detectionResult = Detector.DetectCalibrationBoard(frame); - var cameraToCheckerboardTransform = new Zivid.NET.Matrix4x4(detectionResult.Pose().ToMatrix()); - Console.WriteLine(cameraToCheckerboardTransform); + var detectionResult = Detector.DetectFeaturePoints(pointCloud); + var transformCameraToCheckerboard = new Zivid.NET.Matrix4x4(detectionResult.Pose().ToMatrix()); + Console.WriteLine(transformCameraToCheckerboard); Console.WriteLine("Camera pose in checkerboard frame:"); - var checkerboardToCameraTransform = cameraToCheckerboardTransform.Inverse(); - Console.WriteLine(checkerboardToCameraTransform); - - var transformFile = "CheckerboardToCameraTransform.yaml"; - Console.WriteLine("Saving a YAML file with Inverted checkerboard pose to file: " + transformFile); - checkerboardToCameraTransform.Save(transformFile); + var transformCheckerboardToCamera = transformCameraToCheckerboard.Inverse(); + Console.WriteLine(transformCheckerboardToCamera); Console.WriteLine("Transforming point cloud from camera frame to Checkerboard frame"); - pointCloud.Transform(checkerboardToCameraTransform); + pointCloud.Transform(transformCheckerboardToCamera); var checkerboardTransformedFile = "CalibrationBoardInCheckerboardOrigin.zdf"; Console.WriteLine("Saving transformed point cloud to file: " + checkerboardTransformedFile); diff --git a/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cs b/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cs index ba5e91b..6d50613 100644 --- a/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cs +++ b/source/Applications/Basic/Visualization/ProjectImageStartAndStop/ProjectImageStartAndStop.cs @@ -36,13 +36,13 @@ static int Main() using (var camera = zivid.ConnectCamera()) { Console.WriteLine("Retrieving the projector resolution that the camera supports"); - var projectorResolution = Zivid.NET.Projection.Projection.ProjectorResolution(camera); + var projectorResolution = Zivid.NET.Experimental.Projection.Projection.ProjectorResolution(camera); var redColor = new Zivid.NET.ColorBGRA { b = 0, g = 0, r = 255, a = 255 }; var projectorImage = CreateProjectorImage(projectorResolution, redColor); - var projectedImageHandle = Zivid.NET.Projection.Projection.ShowImage(camera, projectorImage); + var projectedImageHandle = Zivid.NET.Experimental.Projection.Projection.ShowImage(camera, projectorImage); Console.WriteLine("Press enter to stop projecting using the \".Stop()\" function"); Console.ReadLine(); @@ -50,7 +50,7 @@ static int Main() var greenColor = new Zivid.NET.ColorBGRA { b = 0, g = 255, r = 0, a = 255 }; projectorImage = CreateProjectorImage(projectorResolution, greenColor); - using (projectedImageHandle = Zivid.NET.Projection.Projection.ShowImage(camera, projectorImage)) + using (projectedImageHandle = Zivid.NET.Experimental.Projection.Projection.ShowImage(camera, projectorImage)) { Console.WriteLine("Press enter to stop projecting by leaving a local scope"); Console.ReadLine(); @@ -58,7 +58,7 @@ static int Main() var zividPinkColor = new Zivid.NET.ColorBGRA { b = 114, g = 52, r = 237, a = 255 }; projectorImage = CreateProjectorImage(projectorResolution, zividPinkColor); - projectedImageHandle = Zivid.NET.Projection.Projection.ShowImage(camera, projectorImage); + projectedImageHandle = Zivid.NET.Experimental.Projection.Projection.ShowImage(camera, projectorImage); Console.WriteLine("Press enter to stop projecting by performing a 3D capture"); Console.ReadLine(); diff --git a/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cs b/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cs index d9791bd..b6143ba 100644 --- a/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cs +++ b/source/Applications/Basic/Visualization/ReadAndProjectImage/ReadAndProjectImage.cs @@ -23,7 +23,7 @@ static int Main() Console.WriteLine("Reading 2D image (of resolution matching the Zivid camera projector resolution) from file: " + projectorImageFileForGivenCamera); var projectorImageForGivenCamera = new Zivid.NET.ImageBGRA(projectorImageFileForGivenCamera); - using (var projectedImageHandle = Zivid.NET.Projection.Projection.ShowImage(camera, projectorImageForGivenCamera)) + using (var projectedImageHandle = Zivid.NET.Experimental.Projection.Projection.ShowImage(camera, projectorImageForGivenCamera)) { // A Local Scope to handle the projected image lifetime var settings2D = new Zivid.NET.Settings2D diff --git a/source/Applications/PointCloudTutorial.md b/source/Applications/PointCloudTutorial.md index ce16972..5f20157 100644 --- a/source/Applications/PointCloudTutorial.md +++ b/source/Applications/PointCloudTutorial.md @@ -32,12 +32,10 @@ data. Tip: -> If you prefer watching a video, our webinar [Getting your point cloud -> ready for your -> application](https://www.zivid.com/webinars-page?wchannelid=ffpqbqc7sg&wmediaid=h66zph71vo) -> covers the Point Cloud Tutorial. - -**Prerequisites** +If you prefer watching a video, our webinar [Getting your point cloud +ready for your +application](https://www.zivid.com/webinars-page?wchannelid=ffpqbqc7sg&wmediaid=h66zph71vo) +covers the Point Cloud Tutorial. .. rubric:: Prerequisites - Install [Zivid Software](https://support.zivid.com/latest//getting-started/software-installation.html). @@ -103,13 +101,11 @@ copying from GPU memory. Note: -`Zivid.NET.Camera.Capture()` method returns at some moment in time after -the camera completes capturing raw images. The handle from -`Zivid.NET.Frame.PointCloud` is available instantly. However, the actual -point cloud data becomes available only after the processing on the GPU -is finished. Any calls to data-copy methods (section below) will block -and wait for processing to finish before proceeding with the requested -copy operation. +The handle from `Zivid.NET.Frame.PointCloud` is available instantly. +However, the actual point cloud data becomes available only after the +processing on the GPU is finished. Any calls to data-copy methods +(section below) will block and wait for processing to finish before +proceeding with the requested copy operation. For detailed explanation, see [Point Cloud Capture Process](https://support.zivid.com/latest/academy/camera/point-cloud-capture-process.html). @@ -178,11 +174,10 @@ the point cloud. Note: -> [Monochrome -> Capture](https://support.zivid.com/latest/academy/camera/monochrome-capture.html) -> is a hardware-based subsample method that reduces the resolution of -> the point cloud during capture while also reducing the acquisition and -> capture time. +[Monochrome +Capture](https://support.zivid.com/latest/academy/camera/monochrome-capture.html) +is a hardware-based subsample method that reduces the resolution of the +point cloud during capture while also reducing the capture time. ----- diff --git a/source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cs b/source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cs index 24ce7e5..2a7c295 100644 --- a/source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cs +++ b/source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cs @@ -47,6 +47,9 @@ static string SettingsFolder(Zivid.NET.Camera camera) var model = camera.Info.Model; switch (model) { + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusSmall: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusMedium: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusLarge: return "zividOne"; case Zivid.NET.CameraInfo.ModelOption.ZividTwo: return "zivid2"; case Zivid.NET.CameraInfo.ModelOption.ZividTwoL100: return "zivid2"; case Zivid.NET.CameraInfo.ModelOption.Zivid2PlusM130: return "zivid2Plus"; diff --git a/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cs b/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cs index b3e9799..35138e1 100644 --- a/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cs +++ b/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cs @@ -5,7 +5,7 @@ using System; using Duration = Zivid.NET.Duration; using ReflectionFilterModeOption = - Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ModeOption; + Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ExperimentalGroup.ModeOption; class Program { @@ -34,7 +34,7 @@ static int Main() Console.WriteLine( "Manually configuring processing settings (Capture Assistant only suggests acquisition settings)"); settings.Processing.Filters.Reflection.Removal.Enabled = true; - settings.Processing.Filters.Reflection.Removal.Mode = ReflectionFilterModeOption.Global; + settings.Processing.Filters.Reflection.Removal.Experimental.Mode = ReflectionFilterModeOption.Global; settings.Processing.Filters.Smoothing.Gaussian.Enabled = true; settings.Processing.Filters.Smoothing.Gaussian.Sigma = 1.5; diff --git a/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs b/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs index 45fd74d..042fda8 100644 --- a/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs +++ b/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs @@ -10,7 +10,7 @@ See the instructions in README.md to download the Zivid Sample Data. using System; using ReflectionFilterModeOption = - Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ModeOption; + Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ExperimentalGroup.ModeOption; class Program { @@ -40,7 +40,7 @@ static int Main(string[] args) { Acquisitions = { new Zivid.NET.Settings.Acquisition { } }, Processing = { Filters = { Smoothing = { Gaussian = { Enabled = true, Sigma = 1.5 } }, - Reflection = { Removal = { Enabled = true, Mode = ReflectionFilterModeOption.Global} } }, + Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } } }, Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 } } } }; diff --git a/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs b/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs index 59bd4f3..62b4268 100644 --- a/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs +++ b/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs @@ -16,7 +16,7 @@ This sample also demonstrates how to save and load settings from file. using ColorModeOption = Zivid.NET.Settings.ProcessingGroup.ColorGroup.ExperimentalGroup.ModeOption; using ReflectionFilterModeOption = - Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ModeOption; + Zivid.NET.Settings.ProcessingGroup.FiltersGroup.ReflectionGroup.RemovalGroup.ExperimentalGroup.ModeOption; class Program { static int Main() @@ -31,8 +31,8 @@ static int Main() Console.WriteLine("Configuring settings for capture:"); var settings = new Zivid.NET.Settings() { - Engine = Zivid.NET.Settings.EngineOption.Phase, - Sampling = { Color = Zivid.NET.Settings.SamplingGroup.ColorOption.Rgb, Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.BlueSubsample2x2 }, + Experimental = { Engine = Zivid.NET.Settings.ExperimentalGroup.EngineOption.Phase }, + Sampling = { Color = Zivid.NET.Settings.SamplingGroup.ColorOption.Rgb, Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.All }, RegionOfInterest = { Box = { Enabled = true, PointO = new Zivid.NET.PointXYZ{ x = 1000, y = 1000, z = 1000 }, @@ -51,14 +51,15 @@ static int Main() Suppression = { Enabled = true }, Repair ={ Enabled = true } }, Outlier = { Removal = { Enabled = true, Threshold = 5.0 } }, - Reflection = { Removal = { Enabled = true, Mode = ReflectionFilterModeOption.Global} }, + Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } }, Cluster = { Removal = { Enabled = true, MaxNeighborDistance = 10, MinArea = 100} }, - Hole = { Repair = { Enabled = true, HoleSize = 0.2, Strictness = 1 } }, Experimental = { ContrastDistortion = { Correction = { Enabled = true, Strength = 0.4 }, Removal = { Enabled = true, - Threshold = 0.5 } } } }, - Resampling = { Mode = Zivid.NET.Settings.ProcessingGroup.ResamplingGroup.ModeOption.Upsample2x2}, + Threshold = 0.5 } }, + HoleFilling = { Enabled = true, + HoleSize = 0.2, + Strictness = 1 } } }, Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 }, Gamma = 1.0, Experimental = { Mode = ColorModeOption.Automatic } } } @@ -124,6 +125,16 @@ static Tuple GetExposureValues(Zivid.N var model = camera.Info.Model; switch (model) { + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusSmall: + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusMedium: + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusLarge: + { + double[] aperture = { 8.0, 4.0, 1.4 }; + Duration[] exposureTime = { Duration.FromMicroseconds(6500), Duration.FromMicroseconds(10000), Duration.FromMicroseconds(40000) }; + double[] gain = { 1.0, 1.0, 2.0 }; + double[] brightness = { 1.8, 1.8, 1.8 }; + return Tuple.Create(aperture, exposureTime, gain, brightness); + } case Zivid.NET.CameraInfo.ModelOption.ZividTwo: case Zivid.NET.CameraInfo.ModelOption.ZividTwoL100: { diff --git a/source/Camera/Basic/CaptureTutorial.md b/source/Camera/Basic/CaptureTutorial.md index 8c2ed20..9c6aa19 100644 --- a/source/Camera/Basic/CaptureTutorial.md +++ b/source/Camera/Basic/CaptureTutorial.md @@ -14,7 +14,6 @@ tutorial see: [**Connect**](#Connect) | [**Configure**](#Configure) | [**Capture**](#Capture) | -[**Save**](#Save) | [**Multithreading**](#Multithreading) | [**Conclusion**](#Conclusion) @@ -34,12 +33,11 @@ MATLAB](https://github.com/zivid/zivid-matlab-samples/blob/master/source/Camera/ Tip: -> If you prefer watching a video, our webinar [Making 3D captures easy - -> A tour of Zivid Studio and Zivid -> SDK](https://www.zivid.com/webinars-page?wchannelid=ffpqbqc7sg&wmediaid=ce68dbjldk) -> covers the same content as the Capture Tutorial. - -**Prerequisites** +If you prefer watching a video, our webinar [Making 3D captures easy - A +tour of Zivid Studio and Zivid +SDK](https://www.zivid.com/webinars-page?wchannelid=ffpqbqc7sg&wmediaid=ce68dbjldk) +covers the same content as the Capture Tutorial. .. rubric:: +Prerequisites - Install [Zivid Software](https://support.zivid.com/latest//getting-started/software-installation.html). @@ -92,7 +90,7 @@ var camera = zivid.ConnectCamera(new Zivid.NET.CameraInfo.SerialNumber("2020C0DE Note: -> The serial number of your camera is shown in the Zivid Studio. +The serial number of your camera is shown in the Zivid Studio. ----- @@ -148,7 +146,7 @@ var settings = new Zivid.NET.Settings { Acquisitions = { new Zivid.NET.Settings.Acquisition { } }, Processing = { Filters = { Smoothing = { Gaussian = { Enabled = true, Sigma = 1.5 } }, - Reflection = { Removal = { Enabled = true, Mode = ReflectionFilterModeOption.Global} } }, + Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } } }, Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 } } } }; ``` @@ -211,8 +209,8 @@ There are only two parameters to configure with Capture Assistant: Another option is to configure settings manually. For more information about what each settings does, please see [Camera Settings](https://support.zivid.com/latest/reference-articles/camera-settings.html). -Then, the next step it's [Capturing High Quality Point -Clouds](https://support.zivid.com/latest/academy/camera/capturing-high-quality-point-clouds.html) +Note that Zivid 2 has a set of [standard +settings](https://support.zivid.com/latest//reference-articles/standard-acquisition-settings-zivid-two.html). #### Single Acquisition @@ -249,14 +247,14 @@ foreach (var aperture in new double[] { 9.57, 4.76, 2.59 }) Fully configured settings are demonstrated below. ([go to -source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L31-L93)) +source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L31-L94)) ``` sourceCode cs Console.WriteLine("Configuring settings for capture:"); var settings = new Zivid.NET.Settings() { - Engine = Zivid.NET.Settings.EngineOption.Phase, - Sampling = { Color = Zivid.NET.Settings.SamplingGroup.ColorOption.Rgb, Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.BlueSubsample2x2 }, + Experimental = { Engine = Zivid.NET.Settings.ExperimentalGroup.EngineOption.Phase }, + Sampling = { Color = Zivid.NET.Settings.SamplingGroup.ColorOption.Rgb, Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.All }, RegionOfInterest = { Box = { Enabled = true, PointO = new Zivid.NET.PointXYZ{ x = 1000, y = 1000, z = 1000 }, @@ -275,14 +273,15 @@ var settings = new Zivid.NET.Settings() Suppression = { Enabled = true }, Repair ={ Enabled = true } }, Outlier = { Removal = { Enabled = true, Threshold = 5.0 } }, - Reflection = { Removal = { Enabled = true, Mode = ReflectionFilterModeOption.Global} }, + Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } }, Cluster = { Removal = { Enabled = true, MaxNeighborDistance = 10, MinArea = 100} }, - Hole = { Repair = { Enabled = true, HoleSize = 0.2, Strictness = 1 } }, Experimental = { ContrastDistortion = { Correction = { Enabled = true, Strength = 0.4 }, Removal = { Enabled = true, - Threshold = 0.5 } } } }, - Resampling = { Mode = Zivid.NET.Settings.ProcessingGroup.ResamplingGroup.ModeOption.Upsample2x2}, + Threshold = 0.5 } }, + HoleFilling = { Enabled = true, + HoleSize = 0.2, + Strictness = 1 } } }, Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 }, Gamma = 1.0, Experimental = { Mode = ColorModeOption.Automatic } } } @@ -344,7 +343,7 @@ Check out for recommended .yml files tuned for your application. ([go to -source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L105-L110)) +source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L106-L111)) ``` sourceCode cs var settingsFile = "Settings.yml"; @@ -357,7 +356,7 @@ var settingsFromFile = new Zivid.NET.Settings(settingsFile); You can also save settings to .yml file. ([go to -source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L105-L107)) +source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs#L106-L108)) ``` sourceCode cs var settingsFile = "Settings.yml"; @@ -415,7 +414,16 @@ source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera using (var frame2D = camera.Capture(settings2D)) ``` -## Save +----- + +Caution\!: + +> Zivid One+ camera has a time penalty when changing the capture mode +> (2D and 3D) if the 2D capture settings use brightness \> 0. + +You can read more about it in [2D and 3D switching +limitation](https://support.zivid.com/latest//support/2d-3d-switching-limitation.html). +Save ---- We can now save our results. @@ -431,10 +439,9 @@ frame.Save(dataFile); Tip: -> You can open and view `Frame.zdf` file in [Zivid -> Studio](https://support.zivid.com/latest//getting-started/studio-guide.html). - -### Export +You can open and view `Frame.zdf` file in [Zivid +Studio](https://support.zivid.com/latest//getting-started/studio-guide.html). +Export ^^^^^^ The API detects which format to use. See [Point Cloud](https://support.zivid.com/latest//reference-articles/point-cloud-structure-and-output-formats.html) @@ -453,11 +460,8 @@ frame.Save(dataFilePLY); We can get 2D color image from a 3D capture. -``` sourceCode csharp -var image = PointCloud.CopyImageRGBA(); -``` - -2D captures also produce 2D color images. +No source available for {language\_name}2D captures also produce 2D +color images. ([go to source](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/Capture2D/Capture2D.cs#L33)) diff --git a/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cs b/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cs index e98865b..a6f884b 100644 --- a/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cs +++ b/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cs @@ -44,6 +44,9 @@ static string SettingsFolder(Zivid.NET.Camera camera) var model = camera.Info.Model; switch (model) { + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusSmall: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusMedium: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusLarge: return "zividOne"; case Zivid.NET.CameraInfo.ModelOption.ZividTwo: return "zivid2"; case Zivid.NET.CameraInfo.ModelOption.ZividTwoL100: return "zivid2"; case Zivid.NET.CameraInfo.ModelOption.Zivid2PlusM130: return "zivid2Plus"; diff --git a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/App.config b/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/App.config deleted file mode 100644 index 4828147..0000000 --- a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.cs b/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.cs deleted file mode 100644 index f405cbf..0000000 --- a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* -Automatically set the IP addresses of any number of cameras to be in the same subnet as the provided IP address of the network interface. -*/ - -using System; -using System.Net; -using Zivid.NET; - -class Program -{ - - static int Main(string[] args) - { - try - { - var (ipAddress, subnetMask) = ParseOptions(args); - AssertUserInput(ipAddress, subnetMask); - var ipAddressOctets = IPAddress.Parse(ipAddress).GetAddressBytes(); - - // defines the last octet of the ip address of the first Zivid camera. Eg.: x.x.x.2 - int nextIpAddressLastOctet = 2; - var newIpAddressOctets = ipAddressOctets; - - var zivid = new Zivid.NET.Application(); - var cameras = zivid.Cameras; - - if (cameras.Count == 0) - { - throw new InvalidOperationException("No cameras connected"); - } - - foreach (var camera in cameras) - { - if (nextIpAddressLastOctet == ipAddressOctets[3]) - { - nextIpAddressLastOctet += 1; - } - - newIpAddressOctets[3] = (byte)nextIpAddressLastOctet; - IPAddress newIpAddress = new IPAddress(newIpAddressOctets); - - var newConfig = new Zivid.NET.NetworkConfiguration() - { - IPV4 = { - Mode = Zivid.NET.NetworkConfiguration.IPV4Group.ModeOption.Manual, - Address = newIpAddress.ToString(), - SubnetMask = subnetMask, - } - }; - - nextIpAddressLastOctet += 1; - - Console.WriteLine($"Applying network configuration to camera {camera.Info.SerialNumber}"); - camera.ApplyNetworkConfiguration(newConfig); - Console.WriteLine($"New {camera.NetworkConfiguration}\n"); - } - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } - - static void UsageException(string message) - { - throw new ArgumentException(message + "\nUsage: --interface-ipv4 [--subnet-mask ]"); - } - - static (string, string) ParseOptions(string[] args) - { - string ipAddress = null; - string subnetMask = "255.255.255.0"; - - for (int i = 0; i < args.Length; i++) - { - if (args[i].Equals("--interface-ipv4")) - { - if (i + 1 < args.Length) - { - ipAddress = args[i + 1]; - i++; - continue; - } - UsageException("Expected IP address of the PC network interface after --interface-ipv4"); - } - if (args[i].Equals("--subnet-mask")) - { - if (i + 1 < args.Length) - { - subnetMask = args[i + 1]; - i++; - continue; - } - UsageException("Expected subnet mask after --subnet-mask"); - } - UsageException("Unrecognized argument"); - } - if (ipAddress == null) - { - UsageException("IPV4 address of the network interface is required"); - } - return (ipAddress, subnetMask); - } - - static void AssertUserInput(string ipAddress, string subnetMask) - { - new Zivid.NET.NetworkConfiguration() - { - IPV4 = { - Address = ipAddress, - SubnetMask = subnetMask, - } - }; - } -} diff --git a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.csproj b/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.csproj deleted file mode 100644 index 392d2b5..0000000 --- a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/AutomaticNetworkConfigurationForCameras.csproj +++ /dev/null @@ -1,85 +0,0 @@ - - - - - Debug - AnyCPU - {FEE22B4E-A257-443B-8B29-E1C8124A18F4} - Exe - Properties - AutomaticNetworkConfigurationForCameras - AutomaticNetworkConfigurationForCameras - v4.5.2 - 512 - true - - - true - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - true - true - - - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - true - true - - - - ..\..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - - \ No newline at end of file diff --git a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/Properties/AssemblyInfo.cs b/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/Properties/AssemblyInfo.cs deleted file mode 100644 index 91d0496..0000000 --- a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("AutomaticNetworkConfigurationForCameras")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AutomaticNetworkConfigurationForCameras")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("FEE22B4E-A257-443B-8B29-E1C8124A18F4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/packages.config b/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/packages.config deleted file mode 100644 index 8fd9745..0000000 --- a/source/Camera/InfoUtilOther/AutomaticNetworkConfigurationForCameras/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cs b/source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cs index 4c74467..a35f207 100644 --- a/source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cs +++ b/source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cs @@ -51,7 +51,10 @@ static string SettingsFolder(Zivid.NET.Camera camera) var model = camera.Info.Model; switch (model) { - case Zivid.NET.CameraInfo.ModelOption.ZividTwo: return "zivid2"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusSmall: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusMedium: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividOnePlusLarge: return "zividOne"; + case Zivid.NET.CameraInfo.ModelOption.ZividTwo: return "zividTwo"; case Zivid.NET.CameraInfo.ModelOption.ZividTwoL100: return "zivid2"; case Zivid.NET.CameraInfo.ModelOption.Zivid2PlusM130: return "zivid2Plus"; case Zivid.NET.CameraInfo.ModelOption.Zivid2PlusM60: return "zivid2Plus"; diff --git a/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs b/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs index 2061f3d..195e8e7 100644 --- a/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs +++ b/source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs @@ -82,20 +82,30 @@ static int Main() Console.WriteLine($"\nAperture: {aperture,5:f2}, Lens Temperature: {temperature,5:f2}°C"); PrintIntrinsicParametersDelta(intrinsics, estimatedIntrinsics); } - var settingsSubsampled = new Zivid.NET.Settings(); - settingsSubsampled.Acquisitions.Add(new Zivid.NET.Settings.Acquisition { }); - settingsSubsampled.Sampling.Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.BlueSubsample2x2; - var fixedIntrinsicsForSubsampledSettingsPath = "FixedIntrinsicsSubsampledBlue2x2.yml"; - Console.WriteLine("Saving camera intrinsics for subsampled capture to file: " + fixedIntrinsicsForSubsampledSettingsPath); - var fixedIntrinsicsForSubsampledSettings = Zivid.NET.Experimental.Calibration.Calibrator.Intrinsics(camera, settingsSubsampled); - fixedIntrinsicsForSubsampledSettings.Save(fixedIntrinsicsForSubsampledSettingsPath); - var frameSubsampled = camera.Capture(settingsSubsampled); - var estimatedIntrinsicsForSubsampledSettings = Zivid.NET.Experimental.Calibration.Calibrator.EstimateIntrinsics(frameSubsampled); - var estimatedIntrinsicsForSubsampledSettingsPath = "EstimatedIntrinsicsFromSubsampledBlue2x2Capture.yml"; - Console.WriteLine("Saving estimated camera intrinsics for subsampled capture to file: " + fixedIntrinsicsForSubsampledSettingsPath); - estimatedIntrinsicsForSubsampledSettings.Save(estimatedIntrinsicsForSubsampledSettingsPath); - Console.WriteLine("\nDifference between fixed and estimated intrinsics for subsampled point cloud:"); - PrintIntrinsicParametersDelta(fixedIntrinsicsForSubsampledSettings, estimatedIntrinsicsForSubsampledSettings); + + if (camera.Info.Model != Zivid.NET.CameraInfo.ModelOption.ZividOnePlusSmall && + camera.Info.Model != Zivid.NET.CameraInfo.ModelOption.ZividOnePlusMedium && + camera.Info.Model != Zivid.NET.CameraInfo.ModelOption.ZividOnePlusLarge) + { + var settingsSubsampled = new Zivid.NET.Settings(); + settingsSubsampled.Acquisitions.Add(new Zivid.NET.Settings.Acquisition { }); + settingsSubsampled.Sampling.Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.BlueSubsample2x2; + var fixedIntrinsicsForSubsampledSettingsPath = "FixedIntrinsicsSubsampledBlue2x2.yml"; + Console.WriteLine("Saving camera intrinsics for subsampled capture to file: " + fixedIntrinsicsForSubsampledSettingsPath); + var fixedIntrinsicsForSubsampledSettings = Zivid.NET.Experimental.Calibration.Calibrator.Intrinsics(camera, settingsSubsampled); + fixedIntrinsicsForSubsampledSettings.Save(fixedIntrinsicsForSubsampledSettingsPath); + var frame = camera.Capture(settingsSubsampled); + var estimatedIntrinsicsForSubsampledSettings = Zivid.NET.Experimental.Calibration.Calibrator.EstimateIntrinsics(frame); + var estimatedIntrinsicsForSubsampledSettingsPath = "EstimatedIntrinsicsFromSubsampledBlue2x2Capture.yml"; + Console.WriteLine("Saving estimated camera intrinsics for subsampled capture to file: " + fixedIntrinsicsForSubsampledSettingsPath); + estimatedIntrinsicsForSubsampledSettings.Save(estimatedIntrinsicsForSubsampledSettingsPath); + Console.WriteLine("\nDifference between fixed and estimated intrinsics for subsampled point cloud:"); + PrintIntrinsicParametersDelta(fixedIntrinsicsForSubsampledSettings, estimatedIntrinsicsForSubsampledSettings); + } + else + { + Console.WriteLine(camera.Info.ModelName + " does not support sub-sampled mode."); + } } catch (Exception ex) { diff --git a/source/Camera/InfoUtilOther/NetworkConfiguration/App.config b/source/Camera/InfoUtilOther/NetworkConfiguration/App.config deleted file mode 100644 index 4828147..0000000 --- a/source/Camera/InfoUtilOther/NetworkConfiguration/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.cs b/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.cs deleted file mode 100644 index 0e9d16b..0000000 --- a/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.cs +++ /dev/null @@ -1,110 +0,0 @@ -/* -Uses Zivid API to change the IP address of the Zivid camera. -*/ - -using System; -using System.Net.NetworkInformation; - -class NetworkConfiguration -{ - static bool Confirm(string message) - { - while (true) - { - Console.Write(message + " [Y/n] "); - string input = Console.ReadLine(); - if (input.Equals("y", StringComparison.OrdinalIgnoreCase) || - input.Equals("yes", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - else if (input.Equals("n", StringComparison.OrdinalIgnoreCase) || - input.Equals("no", StringComparison.OrdinalIgnoreCase)) - { - return false; - } - else - { - Console.WriteLine("Invalid input. Please enter 'Y' or 'n'."); - } - } - } - - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - if (zivid.Cameras.Count == 0) - { - throw new System.Exception("Failed to connect to camera. No cameras found."); - } - - var camera = zivid.Cameras[0]; - - var originalConfig = camera.NetworkConfiguration; - - Console.WriteLine("Current network configuration of camera {0}:", camera.Info.SerialNumber); - Console.WriteLine(originalConfig.ToString()); - Console.WriteLine(); - - var mode = Zivid.NET.NetworkConfiguration.IPV4Group.ModeOption.Manual; - var address = originalConfig.IPV4.Address; - var subnetMask = originalConfig.IPV4.SubnetMask; - - if (Confirm("Do you want to use DHCP?")) - { - mode = Zivid.NET.NetworkConfiguration.IPV4Group.ModeOption.Dhcp; - } - else - { - Console.Write("Enter IPv4 Address [{0}]: ", originalConfig.IPV4.Address); - var inputAddress = Console.ReadLine(); - if (!string.IsNullOrEmpty(inputAddress)) - { - address = inputAddress; - } - Console.Write("Enter new Subnet mask [{0}]: ", originalConfig.IPV4.SubnetMask); - var inputSubnetMask = Console.ReadLine(); - if (!string.IsNullOrEmpty(inputSubnetMask)) - { - subnetMask = inputSubnetMask; - } - } - - var newConfig = new Zivid.NET.NetworkConfiguration() - { - IPV4 = { - Mode = mode, - Address = address, - SubnetMask = subnetMask, - } - }; - - Console.WriteLine(); - Console.WriteLine("New network configuration:"); - Console.WriteLine(newConfig.ToString()); - if (!Confirm(string.Format("Do you want to apply the new network configuration to camera {0}?", camera.Info.SerialNumber))) - { - return 0; - } - - Console.WriteLine("Applying network configuration..."); - camera.ApplyNetworkConfiguration(newConfig); - - Console.WriteLine("Updated network configuration of camera {0}:", camera.Info.SerialNumber); - Console.WriteLine(camera.NetworkConfiguration.ToString()); - Console.WriteLine(); - - Console.WriteLine("Camera status is '{0}'", camera.State.Status); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} - diff --git a/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.csproj b/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.csproj deleted file mode 100644 index e2f7a52..0000000 --- a/source/Camera/InfoUtilOther/NetworkConfiguration/NetworkConfiguration.csproj +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Debug - AnyCPU - {121101E4-E682-4850-8638-6C47873A57EA} - Exe - Properties - NetworkConfiguration - NetworkConfiguration - v4.5.2 - 512 - true - - - true - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - true - true - - - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - true - true - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - - \ No newline at end of file diff --git a/source/Camera/InfoUtilOther/NetworkConfiguration/Properties/AssemblyInfo.cs b/source/Camera/InfoUtilOther/NetworkConfiguration/Properties/AssemblyInfo.cs deleted file mode 100644 index d3b3825..0000000 --- a/source/Camera/InfoUtilOther/NetworkConfiguration/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("NetworkConfiguration")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NetworkConfiguration")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("121101E4-E682-4850-8638-6C47873A57EA")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/Maintenance/CorrectCameraInField/App.config b/source/Camera/Maintenance/CorrectCameraInField/App.config deleted file mode 100644 index 1ab2984..0000000 --- a/source/Camera/Maintenance/CorrectCameraInField/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cs b/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cs deleted file mode 100644 index 45f2060..0000000 --- a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* -Correct the dimension trueness of a Zivid camera. - -This example shows how to perform In-field correction. This involves gathering data from -a compatible calibration board at several distances, calculating an updated camera -correction, and optionally saving that new correction to the camera. - -The correction will persist on the camera even though the camera is power-cycled or -connected to a different PC. After saving a correction, it will automatically be used any -time that camera captures a new point cloud. - -Note: This example uses experimental SDK features, which may be modified, moved, or deleted in the future without notice. -*/ - -using System; -using System.Collections.Generic; - -class Program -{ - static bool YesNoPrompt(string question) - { - while (true) - { - Console.WriteLine(question + ": y/n"); - var response = Console.ReadLine(); - if (response == null || response.ToLower() == "n") - { - return false; - } - if (response.ToLower() == "y") - { - return true; - } - } - } - - static List CollectDataset(Zivid.NET.Camera camera) - { - var dataset = new List(); - Console.WriteLine("Please point the camera at a Zivid infield calibration board."); - - const string printLine = "------------------------------------------------------------------------"; - while (true) - { - Console.WriteLine(printLine); - if (YesNoPrompt("Capture (y) or finish (n)?")) - { - Console.WriteLine("Capturing calibration board"); - var detectionResult = Zivid.NET.Calibration.Detector.DetectCalibrationBoard(camera); - var input = new Zivid.NET.Experimental.Calibration.InfieldCorrectionInput(detectionResult); - - if (input.Valid) - { - dataset.Add(input); - Console.WriteLine("Valid measurement at: " + input.DetectionResult.Centroid().ToString()); - } - else - { - Console.WriteLine("****INVALID****"); - Console.WriteLine("Feedback: " + input.StatusDescription()); - } - Console.WriteLine(printLine); - } - else - { - Console.WriteLine("End of capturing stage."); - Console.WriteLine(printLine); - break; - } - Console.WriteLine("You have collected " + dataset.Count + " valid measurements so far."); - } - return dataset; - } - - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - Console.WriteLine("Connecting to camera"); - var camera = zivid.ConnectCamera(); - - // Gather data - var dataset = CollectDataset(camera); - - // Calculate infield correction - Console.WriteLine("Collected " + dataset.Count + " valid measurements."); - Console.WriteLine("Computing new camera correction..."); - var correction = Zivid.NET.Experimental.Calibration.Calibrator.ComputeCameraCorrection(dataset); - var accuracyEstimate = correction.AccuracyEstimate; - Console.WriteLine("If written to the camera, this correction can be expected to yield a dimension accuracy error of " - + (accuracyEstimate.DimensionAccuracy * 100).ToString("0.00") + "% or better in the range of z=[" - + accuracyEstimate.ZMin.ToString("0.00") + "," + accuracyEstimate.ZMax.ToString("0.00") - + "] across the full FOV. Accuracy close to where the correction data was collected is likely better."); - - // Optionally save to camera - if (YesNoPrompt("Save to camera?")) - { - Console.WriteLine("Writing camera correction..."); - Zivid.NET.Experimental.Calibration.Calibrator.WriteCameraCorrection(camera, correction); - Console.WriteLine("Success"); - } - - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} diff --git a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.csproj b/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.csproj deleted file mode 100644 index da8e52c..0000000 --- a/source/Camera/Maintenance/CorrectCameraInField/CorrectCameraInField.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Debug - AnyCPU - {8D35FE40-515E-416A-9C44-503B0D1B6674} - Exe - CorrectCameraInField - CorrectCameraInField - v4.5.2 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE;CODE_ANALYSIS - prompt - 4 - true - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Camera/Maintenance/CorrectCameraInField/Properties/AssemblyInfo.cs b/source/Camera/Maintenance/CorrectCameraInField/Properties/AssemblyInfo.cs deleted file mode 100644 index 8b393aa..0000000 --- a/source/Camera/Maintenance/CorrectCameraInField/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("VerifyCameraInField")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("VerifyCameraInField")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("47B616E7-382D-47F6-BD0B-9C627C710A64")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/Maintenance/ResetCameraInField/App.config b/source/Camera/Maintenance/ResetCameraInField/App.config deleted file mode 100644 index 1ab2984..0000000 --- a/source/Camera/Maintenance/ResetCameraInField/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/Maintenance/ResetCameraInField/Properties/AssemblyInfo.cs b/source/Camera/Maintenance/ResetCameraInField/Properties/AssemblyInfo.cs deleted file mode 100644 index 82be996..0000000 --- a/source/Camera/Maintenance/ResetCameraInField/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("VerifyCameraInField")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("VerifyCameraInField")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0CD32246-E361-450C-92D1-0ECAF2DFD5E1")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cs b/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cs deleted file mode 100644 index 780e534..0000000 --- a/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* -Reset infield correction on a camera. - -Note: This example uses experimental SDK features, which may be modified, moved, or deleted in the future without notice. -*/ - -using System; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - Console.WriteLine("Connecting to camera"); - var camera = zivid.ConnectCamera(); - - Console.WriteLine("Reset infield correction on the camera"); - Zivid.NET.Experimental.Calibration.Calibrator.ResetCameraCorrection(camera); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} diff --git a/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.csproj b/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.csproj deleted file mode 100644 index 6dac1a9..0000000 --- a/source/Camera/Maintenance/ResetCameraInField/ResetCameraInField.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Debug - AnyCPU - {007E5DE9-EB5C-4EAA-A609-FEA14196F3BD} - Exe - ResetCameraInField - ResetCameraInField - v4.5.2 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE;CODE_ANALYSIS - prompt - 4 - true - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Camera/Maintenance/VerifyCameraInField/App.config b/source/Camera/Maintenance/VerifyCameraInField/App.config deleted file mode 100644 index 1ab2984..0000000 --- a/source/Camera/Maintenance/VerifyCameraInField/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/Maintenance/VerifyCameraInField/Properties/AssemblyInfo.cs b/source/Camera/Maintenance/VerifyCameraInField/Properties/AssemblyInfo.cs deleted file mode 100644 index b43712e..0000000 --- a/source/Camera/Maintenance/VerifyCameraInField/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("VerifyCameraInField")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("VerifyCameraInField")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("14D5F2B5-93BB-4A49-A0CD-0A56B2AF7B20")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cs b/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cs deleted file mode 100644 index 56b4cd2..0000000 --- a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -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 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. -*/ - -using System; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - Console.WriteLine("Connecting to camera"); - var camera = zivid.ConnectCamera(); - - // For convenience, print the timestamp of the latest correction - if (Zivid.NET.Experimental.Calibration.Calibrator.HasCameraCorrection(camera)) - { - var timestamp = Zivid.NET.Experimental.Calibration.Calibrator.CameraCorrectionTimestamp(camera); - Console.WriteLine("Timestamp of curent camera correction: " + timestamp.ToString()); - } - else - { - Console.WriteLine("This camera has no infield correction written to it."); - } - - // Gather data - Console.WriteLine("Capturing calibration board"); - var detectionResult = Zivid.NET.Calibration.Detector.DetectCalibrationBoard(camera); - - // Prepare data and check that it is appropriate for infield verification - var input = new Zivid.NET.Experimental.Calibration.InfieldCorrectionInput(detectionResult); - if (!input.Valid) - { - throw new Exception("Capture not valid for infield verification! Feedback: " + input.StatusDescription()); - } - - // Show results - Console.WriteLine("Successful measurement at " + detectionResult.Centroid().ToString()); - var verification = Zivid.NET.Experimental.Calibration.Calibrator.VerifyCamera(input); - Console.WriteLine("Estimated dimenstion trueness error at measured position: " + (verification.LocalDimensionTrueness * 100).ToString("0.00") + "%"); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} diff --git a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.csproj b/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.csproj deleted file mode 100644 index ad27dcc..0000000 --- a/source/Camera/Maintenance/VerifyCameraInField/VerifyCameraInField.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Debug - AnyCPU - {471E7FCF-9689-460F-810C-B8C0EBC81EC3} - Exe - VerifyCameraInField - VerifyCameraInField - v4.5.2 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - C:\Users\SATJAS~1\AppData\Local\Temp\vsCB1E.tmp\x64\Debug\ - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE;CODE_ANALYSIS - prompt - 4 - true - C:\Users\SATJAS~1\AppData\Local\Temp\vsCB1E.tmp\x64\Release\ - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/App.config b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/App.config deleted file mode 100644 index 1ab2984..0000000 --- a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/Properties/AssemblyInfo.cs b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/Properties/AssemblyInfo.cs deleted file mode 100644 index b458c9c..0000000 --- a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("VerifyCameraInField")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("VerifyCameraInField")] -[assembly: AssemblyCopyright("Copyright 2015-2021 (C) Zivid AS")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("668D531A-68CA-4568-9D78-3A7D673DD594")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cs b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cs deleted file mode 100644 index 9317173..0000000 --- a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* -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 or handling. If so, look at the CorrectCameraInField -sample. - -Why is verifying camera accuracy from a ZDF file useful? - -Let us assume that your system is in production. You want to verify the accuracy of the camera while the system is running. -At the same time, you want to minimize the time the robot and the camera are used for anything else than their main task, -e.g., bin picking. Instead of running a full infield verification live, which consists of capturing, detecting, and -estimating accuracy, you can instead only capture and save results to ZDF files on disk. As the robot and the camera go -back to their main tasks, you can load the ZDF files and verify the accuracy offline, using a different PC than the one -used in production. In addition, you can send these ZDF files to Zivid Customer Success for investigation. - -Note: This example uses experimental SDK features, which may be modified, moved, or deleted in the future without notice. -*/ - -using System; - -class Program -{ - static int Main() - { - try - { - var zivid = new Zivid.NET.Application(); - - string fileCamera = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/Zivid/BinWithCalibrationBoard.zfc"; - Console.WriteLine("Creating virtual camera using file: " + fileCamera); - var camera = zivid.CreateFileCamera(fileCamera); - - // Calibration board can be captured live, while the system is in production, and saved to ZDF file, for later use in - // offline infield verification - - Console.WriteLine("Capturing calibration board"); - var frame = Zivid.NET.Calibration.Detector.CaptureCalibrationBoard(camera); - var dataFile = "FrameWithCalibrationBoard.zdf"; - Console.WriteLine("Saving frame to file: " + dataFile + ", for later use in offline infield verification"); - frame.Save(dataFile); - - // The ZDF captured with captureCalibrationBoard(camera) that contains the calibration board can be loaded for - // offline infield verification - - Console.WriteLine("Reading ZDF frame from file: " + dataFile + ", for offline infield verification"); - var loadedFrame = new Zivid.NET.Frame(dataFile); - - Console.WriteLine("Detecting calibration board"); - var detectionResult = Zivid.NET.Calibration.Detector.DetectCalibrationBoard(loadedFrame); - - var input = new Zivid.NET.Experimental.Calibration.InfieldCorrectionInput(detectionResult); - if (!input.Valid) - { - throw new Exception("Capture not valid for infield verification! Feedback: " + input.StatusDescription()); - } - - Console.WriteLine("Successful measurement at " + detectionResult.Centroid().ToString()); - var verification = Zivid.NET.Experimental.Calibration.Calibrator.VerifyCamera(input); - Console.WriteLine("Estimated dimension trueness error at measured position: " + (verification.LocalDimensionTrueness * 100).ToString("0.00") + "%"); - } - catch (Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - return 1; - } - return 0; - } -} diff --git a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.csproj b/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.csproj deleted file mode 100644 index cf4d0da..0000000 --- a/source/Camera/Maintenance/VerifyCameraInFieldFromZDF/VerifyCameraInFieldFromZDF.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Debug - AnyCPU - {D8884156-1127-40ED-902A-7DD610786E5A} - Exe - VerifyCameraInFieldFromZDF - VerifyCameraInFieldFromZDF - v4.5.2 - 512 - true - - - x64 - true - full - false - ..\..\..\..\build\$(Configuration)\$(Platform) - DEBUG;TRACE - prompt - 4 - true - - - x64 - pdbonly - true - ..\..\..\..\build\$(Configuration)\$(Platform) - TRACE;CODE_ANALYSIS - prompt - 4 - true - - - - - - - - - - - - $(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll - - - $(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll - - - - - - - - - - - - if $(ConfigurationName) == Debug GOTO Debug -if $(ConfigurationName) == Release GOTO Release -goto Error - -:Debug -xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Release -xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y -exit /B 0 - -:Error -echo Unsupported config -exit /B 1 - - \ No newline at end of file diff --git a/source/ZividNETSamples.sln b/source/ZividNETSamples.sln index ba38af7..50eb9bf 100644 --- a/source/ZividNETSamples.sln +++ b/source/ZividNETSamples.sln @@ -1,6 +1,7 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34511.84 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.902 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Capture", "Camera\Basic\Capture\Capture.csproj", "{DD533F88-E34D-41A8-B734-1B94A5A4A31F}" EndProject @@ -24,8 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureHDRLoop", "Camera\Ad EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureHDRPrintNormals", "Camera\Advanced\CaptureHDRPrintNormals\CaptureHDRPrintNormals.csproj", "{064AA724-CD81-462F-8A07-26440EA41103}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomaticNetworkConfigurationForCameras", "Camera\InfoUtilOther\AutomaticNetworkConfigurationForCameras\AutomaticNetworkConfigurationForCameras.csproj", "{FEE22B4E-A257-443B-8B29-E1C8124A18F4}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraInfo", "Camera\InfoUtilOther\CameraInfo\CameraInfo.csproj", "{6117292F-5426-48A7-91FB-B801126E576E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetCameraIntrinsics", "Camera\InfoUtilOther\GetCameraIntrinsics\GetCameraIntrinsics.csproj", "{A4F8D63B-E3E9-48DD-A950-276245BACE7B}" @@ -38,16 +37,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Warmup", "Camera\InfoUtilOt EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirmwareUpdater", "Camera\InfoUtilOther\FirmwareUpdater\FirmwareUpdater.csproj", "{E47CD88B-1A5D-4EFB-97A6-42AA81C5D722}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkConfiguration", "Camera\InfoUtilOther\NetworkConfiguration\NetworkConfiguration.csproj", "{121101E4-E682-4850-8638-6C47873A57EA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CorrectCameraInField", "Camera\Maintenance\CorrectCameraInField\CorrectCameraInField.csproj", "{8D35FE40-515E-416A-9C44-503B0D1B6674}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResetCameraInField", "Camera\Maintenance\ResetCameraInField\ResetCameraInField.csproj", "{007E5DE9-EB5C-4EAA-A609-FEA14196F3BD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VerifyCameraInField", "Camera\Maintenance\VerifyCameraInField\VerifyCameraInField.csproj", "{471E7FCF-9689-460F-810C-B8C0EBC81EC3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VerifyCameraInFieldFromZDF", "Camera\Maintenance\VerifyCameraInFieldFromZDF\VerifyCameraInFieldFromZDF.csproj", "{D8884156-1127-40ED-902A-7DD610786E5A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureFromFileCameraVis3D", "Applications\Basic\Visualization\CaptureFromFileCameraVis3D\CaptureFromFileCameraVis3D.csproj", "{8108F859-85B2-4063-9D6F-D7B852ADA83B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptureVis3D", "Applications\Basic\Visualization\CaptureVis3D\CaptureVis3D.csproj", "{68EB8781-17AA-42E9-9524-0C18A45278C3}" @@ -72,12 +61,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiCameraCalibration", "A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransformPointCloudViaCheckerboard", "Applications\Advanced\TransformPointCloudViaCheckerboard\TransformPointCloudViaCheckerboard.csproj", "{05DAC246-781C-45B9-8E57-AC58D013522A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransformPointCloudViaArucoMarker", "Applications\Advanced\TransformPointCloudViaArucoMarker\TransformPointCloudViaArucoMarker.csproj", "{2F721053-DE2A-4714-853C-CDDBB5828AB0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ROIBoxViaCheckerboard", "Applications\Advanced\ROIBoxViaCheckerboard\ROIBoxViaCheckerboard.csproj", "{FDAE54C3-5924-462B-BCE9-E8C51CB637B3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ROIBoxViaArucoMarker", "Applications\Advanced\ROIBoxViaArucoMarker\ROIBoxViaArucoMarker.csproj", "{96CC8163-6D2F-4FF9-B89C-FD2A137AC672}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoseConversions", "Applications\Advanced\HandEyeCalibration\PoseConversions\PoseConversions.csproj", "{69416F6A-75DF-436E-85F2-3881CCBEAA9A}" EndProject Global @@ -130,10 +113,6 @@ Global {064AA724-CD81-462F-8A07-26440EA41103}.Debug|x64.Build.0 = Debug|x64 {064AA724-CD81-462F-8A07-26440EA41103}.Release|x64.ActiveCfg = Release|x64 {064AA724-CD81-462F-8A07-26440EA41103}.Release|x64.Build.0 = Release|x64 - {FEE22B4E-A257-443B-8B29-E1C8124A18F4}.Debug|x64.ActiveCfg = Debug|x64 - {FEE22B4E-A257-443B-8B29-E1C8124A18F4}.Debug|x64.Build.0 = Debug|x64 - {FEE22B4E-A257-443B-8B29-E1C8124A18F4}.Release|x64.ActiveCfg = Release|x64 - {FEE22B4E-A257-443B-8B29-E1C8124A18F4}.Release|x64.Build.0 = Release|x64 {6117292F-5426-48A7-91FB-B801126E576E}.Debug|x64.ActiveCfg = Debug|x64 {6117292F-5426-48A7-91FB-B801126E576E}.Debug|x64.Build.0 = Debug|x64 {6117292F-5426-48A7-91FB-B801126E576E}.Release|x64.ActiveCfg = Release|x64 @@ -158,26 +137,6 @@ Global {E47CD88B-1A5D-4EFB-97A6-42AA81C5D722}.Debug|x64.Build.0 = Debug|x64 {E47CD88B-1A5D-4EFB-97A6-42AA81C5D722}.Release|x64.ActiveCfg = Release|x64 {E47CD88B-1A5D-4EFB-97A6-42AA81C5D722}.Release|x64.Build.0 = Release|x64 - {121101E4-E682-4850-8638-6C47873A57EA}.Debug|x64.ActiveCfg = Debug|x64 - {121101E4-E682-4850-8638-6C47873A57EA}.Debug|x64.Build.0 = Debug|x64 - {121101E4-E682-4850-8638-6C47873A57EA}.Release|x64.ActiveCfg = Release|x64 - {121101E4-E682-4850-8638-6C47873A57EA}.Release|x64.Build.0 = Release|x64 - {8D35FE40-515E-416A-9C44-503B0D1B6674}.Debug|x64.ActiveCfg = Debug|x64 - {8D35FE40-515E-416A-9C44-503B0D1B6674}.Debug|x64.Build.0 = Debug|x64 - {8D35FE40-515E-416A-9C44-503B0D1B6674}.Release|x64.ActiveCfg = Release|x64 - {8D35FE40-515E-416A-9C44-503B0D1B6674}.Release|x64.Build.0 = Release|x64 - {007E5DE9-EB5C-4EAA-A609-FEA14196F3BD}.Debug|x64.ActiveCfg = Debug|x64 - {007E5DE9-EB5C-4EAA-A609-FEA14196F3BD}.Debug|x64.Build.0 = Debug|x64 - {007E5DE9-EB5C-4EAA-A609-FEA14196F3BD}.Release|x64.ActiveCfg = Release|x64 - {007E5DE9-EB5C-4EAA-A609-FEA14196F3BD}.Release|x64.Build.0 = Release|x64 - {471E7FCF-9689-460F-810C-B8C0EBC81EC3}.Debug|x64.ActiveCfg = Debug|x64 - {471E7FCF-9689-460F-810C-B8C0EBC81EC3}.Debug|x64.Build.0 = Debug|x64 - {471E7FCF-9689-460F-810C-B8C0EBC81EC3}.Release|x64.ActiveCfg = Release|x64 - {471E7FCF-9689-460F-810C-B8C0EBC81EC3}.Release|x64.Build.0 = Release|x64 - {D8884156-1127-40ED-902A-7DD610786E5A}.Debug|x64.ActiveCfg = Debug|x64 - {D8884156-1127-40ED-902A-7DD610786E5A}.Debug|x64.Build.0 = Debug|x64 - {D8884156-1127-40ED-902A-7DD610786E5A}.Release|x64.ActiveCfg = Release|x64 - {D8884156-1127-40ED-902A-7DD610786E5A}.Release|x64.Build.0 = Release|x64 {8108F859-85B2-4063-9D6F-D7B852ADA83B}.Debug|x64.ActiveCfg = Debug|x64 {8108F859-85B2-4063-9D6F-D7B852ADA83B}.Debug|x64.Build.0 = Debug|x64 {8108F859-85B2-4063-9D6F-D7B852ADA83B}.Release|x64.ActiveCfg = Release|x64 @@ -226,18 +185,6 @@ Global {05DAC246-781C-45B9-8E57-AC58D013522A}.Debug|x64.Build.0 = Debug|x64 {05DAC246-781C-45B9-8E57-AC58D013522A}.Release|x64.ActiveCfg = Release|x64 {05DAC246-781C-45B9-8E57-AC58D013522A}.Release|x64.Build.0 = Release|x64 - {2F721053-DE2A-4714-853C-CDDBB5828AB0}.Debug|x64.ActiveCfg = Debug|x64 - {2F721053-DE2A-4714-853C-CDDBB5828AB0}.Debug|x64.Build.0 = Debug|x64 - {2F721053-DE2A-4714-853C-CDDBB5828AB0}.Release|x64.ActiveCfg = Release|x64 - {2F721053-DE2A-4714-853C-CDDBB5828AB0}.Release|x64.Build.0 = Release|x64 - {FDAE54C3-5924-462B-BCE9-E8C51CB637B3}.Debug|x64.ActiveCfg = Debug|x64 - {FDAE54C3-5924-462B-BCE9-E8C51CB637B3}.Debug|x64.Build.0 = Debug|x64 - {FDAE54C3-5924-462B-BCE9-E8C51CB637B3}.Release|x64.ActiveCfg = Release|x64 - {FDAE54C3-5924-462B-BCE9-E8C51CB637B3}.Release|x64.Build.0 = Release|x64 - {96CC8163-6D2F-4FF9-B89C-FD2A137AC672}.Debug|x64.ActiveCfg = Debug|x64 - {96CC8163-6D2F-4FF9-B89C-FD2A137AC672}.Debug|x64.Build.0 = Debug|x64 - {96CC8163-6D2F-4FF9-B89C-FD2A137AC672}.Release|x64.ActiveCfg = Release|x64 - {96CC8163-6D2F-4FF9-B89C-FD2A137AC672}.Release|x64.Build.0 = Release|x64 {69416F6A-75DF-436E-85F2-3881CCBEAA9A}.Debug|x64.ActiveCfg = Debug|x64 {69416F6A-75DF-436E-85F2-3881CCBEAA9A}.Debug|x64.Build.0 = Debug|x64 {69416F6A-75DF-436E-85F2-3881CCBEAA9A}.Release|x64.ActiveCfg = Release|x64