Skip to content

Commit

Permalink
Samples: Automatic updates to public repository
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
csu-bot-zivid authored and chrisasc committed Aug 10, 2022
1 parent 259d166 commit 55e887d
Show file tree
Hide file tree
Showing 38 changed files with 450 additions and 67 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ from the camera can be used.
- [CameraUserData](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/InfoUtilOther/CameraUserData/CameraUserData.cs) - Store user data on the Zivid camera.
- [CaptureWithDiagnostics](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/InfoUtilOther/CaptureWithDiagnostics/CaptureWithDiagnostics.cs) - Capture point clouds, with color, from the Zivid camera,
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).
- [PrintVersionInfo](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cs) - List connected cameras and print version information.
Expand All @@ -87,6 +88,9 @@ from the camera can be used.
- [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.
- [TransformPointCloudFromMillimetersToMeters](https://github.com/zivid/zivid-csharp-samples/tree/master//source/Applications/Advanced/TransformPointCloudFromMillimetersToMeters/TransformPointCloudFromMillimetersToMeters.cs) - Transform point cloud data from millimeters to meters.
- [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.
- **HandEyeCalibration**
- [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 frame to robot base frame using Hand-Eye
Expand All @@ -112,7 +116,7 @@ git clone https://github.com/zivid/zivid-csharp-samples
Open ZividNETSamples.sln in Visual Studio, build it and run it. If you
are uncertain about doing this, check out [Build C\# Samples using
Visual
Studio](https://support.zivid.com/latest/rst/api-reference/samples/csharp/build-c-sharp-samples-using-visual-studio.html).
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
`YamlDotNet` and `MathNet.Numerics`. These libraries will be installed
Expand All @@ -123,7 +127,7 @@ automatically through NuGet when building the sample.
For more information about the Zivid cameras, please visit our
[Knowledge Base](https://support.zivid.com/latest). If you run into any
issues please check out
[Troubleshooting](https://support.zivid.com/latest/rst/support/troubleshooting.html).
[Troubleshooting](https://support.zivid.com/latest/support/troubleshooting.html).

## License

Expand Down
7 changes: 4 additions & 3 deletions source/Applications/Advanced/Downsample/Downsample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Downsample point cloud from a ZDF file.

class Program
{
static void Main()
static int Main()
{
try
{
Expand Down Expand Up @@ -51,7 +51,8 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Perform Hand-Eye calibration.

class Program
{
static void Main()
static int Main()
{
try
{
Expand All @@ -32,14 +32,15 @@ static void Main()
else
{
Console.WriteLine("Hand-Eye calibration FAILED");
Environment.ExitCode = 1;
return 1;
}
}
catch(Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}

static List<HandEyeInput> readHandEyeInputs(Zivid.NET.Camera camera)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ in this code example. Open the ZDF files in Zivid Studio to inspect the gem's 2D

class Program
{
static void Main()
static int Main()
{
try
{
Expand Down Expand Up @@ -165,8 +165,9 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
static float[,] getTransformationMatrixFromYAML(string transformFile)
{
Expand Down Expand Up @@ -257,4 +258,4 @@ public static RobotCameraConfiguration EnterRobotCameraConfiguration()
default: return RobotCameraConfiguration.Unknown;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Use captures of a calibration object to generate transformation matrices to a si

class Program
{
static void Main()
static int Main()
{
try
{
Expand Down Expand Up @@ -65,8 +65,9 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}

static Zivid.NET.Frame AssistedCapture(Zivid.NET.Camera camera)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Transform point cloud data from millimeters to meters.

class Program
{
static void Main()
static int Main()
{
try
{
Expand All @@ -33,7 +33,8 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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("TransformPointCloudViaCheckerboard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TransformPointCloudViaCheckerboard")]
[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("05DAC246-781C-45B9-8E57-AC58D013522A")]

// 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")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API.
The ZDF file for this sample can be found under the main instructions for Zivid samples.
*/

using System;

using Zivid.NET.Calibration;

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("Detecting and estimating pose of the Zivid checkerboard in the camera frame");
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 transformCheckerboardToCamera = transformCameraToCheckerboard.Inverse();
Console.WriteLine(transformCheckerboardToCamera);

Console.WriteLine("Transforming point cloud from camera frame to Checkerboard frame");
pointCloud.Transform(transformCheckerboardToCamera);

var checkerboardTransformedFile = "CalibrationBoardInCheckerboardOrigin.zdf";
Console.WriteLine("Saving transformed point cloud to file: " + checkerboardTransformedFile);
frame.Save(checkerboardTransformedFile);
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
return 1;
}
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{05DAC246-781C-45B9-8E57-AC58D013522A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>TransformPointCloudViaCheckerboard</RootNamespace>
<AssemblyName>TransformPointCloudViaCheckerboard</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\build\$(Configuration)\$(Platform)</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\build\$(Configuration)\$(Platform)</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="ZividCoreNET" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<HintPath>$(ZIVID_INSTALL_FOLDER)\bin\ZividCoreNET.dll</HintPath>
</Reference>
<Reference Include="ZividCoreNET" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<HintPath>$(ZIVID_INSTALL_FOLDER)\bin_debug\ZividCoreNET.dll</HintPath>
</Reference>
<Reference Include="ZividVisualizationNET" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<HintPath>$(ZIVID_INSTALL_FOLDER)\bin\ZividVisualizationNET.dll</HintPath>
</Reference>
<Reference Include="ZividVisualizationNET" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<HintPath>$(ZIVID_INSTALL_FOLDER)\bin_debug\ZividVisualizationNET.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="TransformPointCloudViaCheckerboard.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>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</PostBuildEvent>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Program
{
static void Main()
static int Main()
{
try
{
Expand Down Expand Up @@ -64,7 +64,8 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
}
}
7 changes: 4 additions & 3 deletions source/Applications/Basic/FileFormats/ZDF2PLY/ZDF2PLY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Convert point cloud from a ZDF file to a PLY file.

class Program
{
static void Main()
static int Main()
{
try
{
Expand All @@ -24,7 +24,8 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This example can be used without access to a physical camera.

class Program
{
static void Main()
static int Main()
{
try
{
Expand Down Expand Up @@ -47,7 +47,8 @@ static void Main()
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
return 1;
}
return 0;
}
}
Loading

0 comments on commit 55e887d

Please sign in to comment.