Skip to content

Commit

Permalink
Merge pull request #72 from zivid/2023-03-31-update-csharp-samples
Browse files Browse the repository at this point in the history
Samples: Automatic updates to public repository
  • Loading branch information
torbsorb committed Apr 5, 2023
2 parents ad99a08 + 162dd8d commit e2ed01e
Show file tree
Hide file tree
Showing 57 changed files with 679 additions and 532 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# C\# samples

This repository contains csharp code samples for Zivid SDK v2.8.1. For
This repository contains csharp code samples for Zivid SDK v2.9.0. For
tested compatibility with earlier SDK versions, please check out
[accompanying
releases](https://github.com/zivid/zivid-csharp-samples/tree/master/../../releases).
Expand Down Expand Up @@ -43,7 +43,7 @@ from the camera can be used.
- [Capture2D](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/Capture2D/Capture2D.cs) - Capture 2D images from the Zivid camera.
- [CaptureAssistant](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureAssistant/CaptureAssistant.cs) - Use Capture Assistant to capture point clouds, with color,
from the Zivid camera.
- [CaptureFromFileCamera](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs) - Capture point clouds, with color, from the Zivid file
- [CaptureFromFileCamera](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cs) - Capture point clouds, with color, with the Zivid file
camera.
- [CaptureHDR](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDR/CaptureHDR.cs) - Capture point clouds, with color, from the Zivid camera.
- [CaptureHDRCompleteSettings](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cs) - Capture point clouds, with color, from the Zivid camera
Expand All @@ -67,15 +67,15 @@ from the camera can be used.
with settings from YML file and diagnostics enabled.
- [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).
model) or estimate them from the point cloud.
- [PrintVersionInfo](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cs) - List connected cameras and print version information.
- [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.
- **Applications**
- **Basic**
- **Visualization**
- [CaptureFromFileCameraVis3D](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Applications/Basic/Visualization/CaptureFromFileCameraVis3D/CaptureFromFileCameraVis3D.cs) - Capture point clouds, with color, from the Zivid file
camera, and visualize them.
- [CaptureFromFileCameraVis3D](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Applications/Basic/Visualization/CaptureFromFileCameraVis3D/CaptureFromFileCameraVis3D.cs) - Capture point clouds, with color, with the Zivid file
camera and visualize them.
- [CaptureVis3D](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Applications/Basic/Visualization/CaptureVis3D/CaptureVis3D.cs) - Capture point clouds, with color, from the Zivid
camera, and visualize them.
- **FileFormats**
Expand Down
4 changes: 2 additions & 2 deletions source/Applications/Advanced/Downsample/Downsample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ static int Main()
visualizer.ShowMaximized();
visualizer.ResetToFit();

Console.WriteLine("Running visualizer. Blocking until window closes");
Console.WriteLine("Running visualizer. Blocking until window closes.");
visualizer.Run();
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
return 1;
Expand Down
26 changes: 13 additions & 13 deletions source/Applications/Advanced/Downsample/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly:AssemblyTitle("Downsample")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("Downsample")]
[assembly:AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
[assembly: AssemblyTitle("Downsample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Downsample")]
[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)]
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly:Guid("4C277491-B475-4DBF-93EC-9FF964B15F03")]
[assembly: Guid("4C277491-B475-4DBF-93EC-9FF964B15F03")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -30,6 +30,6 @@
// Build Number
// Revision

[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static int Main()

var calibrationResult = performCalibration(handEyeInput);

if(calibrationResult.Valid())
if (calibrationResult.Valid())
{
Console.WriteLine("{0}\n{1}\n{2}", "Hand-Eye calibration OK", "Result:", calibrationResult);
}
Expand All @@ -35,7 +35,7 @@ static int Main()
return 1;
}
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
return 1;
Expand All @@ -53,18 +53,18 @@ static List<HandEyeInput> readHandEyeInputs(Zivid.NET.Camera camera)

do
{
switch(Interaction.EnterCommand())
switch (Interaction.EnterCommand())
{
case CommandType.AddPose:
try
{
var robotPose = Interaction.EnterRobotPose(currentPoseId);
using(var frame = Interaction.AssistedCapture(camera))
using (var frame = Interaction.AssistedCapture(camera))
{
Console.Write("Detecting checkerboard in point cloud: ");
var detectionResult = Detector.DetectFeaturePoints(frame.PointCloud);

if(detectionResult.Valid())
if (detectionResult.Valid())
{
Console.WriteLine("Calibration board detected");
handEyeInput.Add(new HandEyeInput(robotPose, detectionResult));
Expand All @@ -76,7 +76,7 @@ static List<HandEyeInput> readHandEyeInputs(Zivid.NET.Camera camera)
}
}
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
continue;
Expand All @@ -87,22 +87,22 @@ static List<HandEyeInput> readHandEyeInputs(Zivid.NET.Camera camera)

case CommandType.Unknown: Console.WriteLine("Error: Unknown command"); break;
}
} while(beingInput);
} while (beingInput);
return handEyeInput;
}

static Zivid.NET.Calibration.HandEyeOutput performCalibration(List<HandEyeInput> handEyeInput)
{
while(true)
while (true)
{
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))
if (calibrationType.Equals("eth", StringComparison.CurrentCultureIgnoreCase))
{
Console.WriteLine("Performing eye-to-hand calibration");
return Calibrator.CalibrateEyeToHand(handEyeInput);
}
if(calibrationType.Equals("eih", StringComparison.CurrentCultureIgnoreCase))
if (calibrationType.Equals("eih", StringComparison.CurrentCultureIgnoreCase))
{
Console.WriteLine("Performing eye-in-hand calibration");
return Calibrator.CalibrateEyeInHand(handEyeInput);
Expand Down Expand Up @@ -133,7 +133,7 @@ public static CommandType EnterCommand()
Console.Write("Enter command, p (to add robot pose) or c (to perform calibration):");
var command = Console.ReadLine().ToLower();

switch(command)
switch (command)
{
case "p": return CommandType.AddPose;
case "c": return CommandType.Calibrate;
Expand All @@ -153,12 +153,13 @@ public static Pose EnterRobotPose(ulong index)
var elements = input.Split().Where(x => !string.IsNullOrEmpty(x.Trim())).Select(x => float.Parse(x)).ToArray();

var robotPose = new Pose(elements); Console.WriteLine("The following pose was entered: \n{0}", robotPose);
return robotPose;
return robotPose;
}

public static Zivid.NET.Frame AssistedCapture(Zivid.NET.Camera camera)
{
var suggestSettingsParameters = new Zivid.NET.CaptureAssistant.SuggestSettingsParameters {
var suggestSettingsParameters = new Zivid.NET.CaptureAssistant.SuggestSettingsParameters
{
AmbientLightFrequency =
Zivid.NET.CaptureAssistant.SuggestSettingsParameters.AmbientLightFrequencyOption.none,
MaxCaptureTime = Duration.FromMilliseconds(800)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly:AssemblyTitle("HandEyeCalibration")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("HandEyeCalibration")]
[assembly:AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
[assembly: AssemblyTitle("HandEyeCalibration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HandEyeCalibration")]
[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)]
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly:Guid("95853884-3FA8-4CAD-B1EF-5AFDFFEFB55C")]
[assembly: Guid("95853884-3FA8-4CAD-B1EF-5AFDFFEFB55C")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -30,6 +30,6 @@
// Build Number
// Revision

[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly:AssemblyTitle("PoseConversions")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("PoseConversions")]
[assembly:AssemblyCopyright("Copyright 2015-2020 (C) Zivid AS")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
[assembly: AssemblyTitle("PoseConversions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoseConversions")]
[assembly: AssemblyCopyright("Copyright 2015-2020 (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)]
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly:Guid("69416F6A-75DF-436E-85F2-3881CCBEAA9A")]
[assembly: Guid("69416F6A-75DF-436E-85F2-3881CCBEAA9A")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -30,6 +30,6 @@
// Build Number
// Revision

[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly:AssemblyTitle("UtilizeEyeInHandCalibration")]
[assembly:AssemblyDescription("")]
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyCompany("")]
[assembly:AssemblyProduct("UtilizeEyeInHandCalibration")]
[assembly:AssemblyCopyright("Copyright 2015-2022 (C) Zivid AS")]
[assembly:AssemblyTrademark("")]
[assembly:AssemblyCulture("")]
[assembly: AssemblyTitle("UtilizeEyeInHandCalibration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UtilizeEyeInHandCalibration")]
[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)]
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly:Guid("1DF2D635-B98C-4605-8AC2-70DB9AC13C5F")]
[assembly: Guid("1DF2D635-B98C-4605-8AC2-70DB9AC13C5F")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -30,6 +30,6 @@
// Build Number
// Revision

[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static int Main()
var transformBaseToCameraMath = CreateMatrix.Diagonal<float>(4, 4);

var loopContinue = true;
while(loopContinue)
while (loopContinue)
{
switch(Interaction.EnterRobotCameraConfiguration())
switch (Interaction.EnterRobotCameraConfiguration())
{
case RobotCameraConfiguration.EyeToHand:

Expand Down Expand Up @@ -116,9 +116,9 @@ static int Main()
var pointCloud = frame.PointCloud;

loopContinue = true;
while(loopContinue)
while (loopContinue)
{
switch(Interaction.EnterCommand())
switch (Interaction.EnterCommand())
{
case Command.TransformSinglePoint:

Expand Down Expand Up @@ -160,7 +160,7 @@ static int Main()
}
}
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
return 1;
Expand Down Expand Up @@ -202,7 +202,7 @@ public static Command EnterCommand()
Console.Write("Enter command, s (to transform single point) or p (to transform point cloud): ");
var command = Console.ReadLine().ToLower();

switch(command)
switch (command)
{
case "s": return Command.TransformSinglePoint;
case "p": return Command.TransformPointCloud;
Expand All @@ -215,7 +215,7 @@ public static RobotCameraConfiguration EnterRobotCameraConfiguration()
Console.Write("Enter type of calibration, eth (for eye-to-hand) or eih (for eye-in-hand): ");
var command = Console.ReadLine().ToLower();

switch(command)
switch (command)
{
case "eth": return RobotCameraConfiguration.EyeToHand;
case "eih": return RobotCameraConfiguration.EyeInHand;
Expand Down
Loading

0 comments on commit e2ed01e

Please sign in to comment.