Skip to content

Commit

Permalink
Merge pull request #45 from zivid/align-list-cameras-code
Browse files Browse the repository at this point in the history
Add sample to list connected cameras
  • Loading branch information
SatjaSivcev authored Sep 27, 2021
2 parents 6ffe025 + 529f5a7 commit b9d58ea
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ There are two main categories of samples: **Camera** and **Applications**. The s
- [**CaptureHDRLoop**][CaptureHDRLoop-url] - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise.
- **InfoUtilOther**
- [**CameraUserData**][CameraUserData-url] - Store user data on the Zivid camera.
- [**GetCameraIntrinsics**][GetCameraIntrinsics-url] - Read intrinsic parameters from the Zivid camera.
- [**GetCameraIntrinsics**][GetCameraIntrinsics-url] - Read intrinsic parameters from the Zivid camera.
- [**PrintVersionInfo**][PrintVersionInfo-url] - List connected cameras and print version information.
- [**Warmup**][Warmup-url] - Warm up the Zivid camera.

- **Applications**
Expand Down Expand Up @@ -93,6 +94,7 @@ Zivid Samples are distributed under the [BSD license](LICENSE).
[CaptureHDRLoop-url]: source/Camera/Advanced/CaptureHDRLoop/CaptureHDRLoop.cs
[CameraUserData-url]: source/Camera/InfoUtilOther/CameraUserData/CameraUserData.cs
[GetCameraIntrinsics-url]: source/Camera/InfoUtilOther/GetCameraIntrinsics/GetCameraIntrinsics.cs
[PrintVersionInfo-url]: source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cs
[Warmup-url]: source/Camera/InfoUtilOther/Warmup/Warmup.cs
[CaptureFromFileVis3D-url]: source/Applications/Basic/Visualization/CaptureFromFileVis3D/CaptureFromFileVis3D.cs
[CaptureVis3D-url]: source/Applications/Basic/Visualization/CaptureVis3D/CaptureVis3D.cs
Expand Down
6 changes: 6 additions & 0 deletions source/Camera/InfoUtilOther/PrintVersionInfo/App.config
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.6.1" />
</startup>
</configuration>
30 changes: 30 additions & 0 deletions source/Camera/InfoUtilOther/PrintVersionInfo/PrintVersionInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
This example shows how to read intrinsic parameters from the Zivid camera (OpenCV model).
*/

using System;

class Program
{
static void Main()
{
try
{
var zivid = new Zivid.NET.Application();
Console.WriteLine("Zivid SDK: {0}", Zivid.NET.Version.CoreVersion.Full);
// DOCTAG-START-LIST-CAMERAS
var cameras = zivid.Cameras;
Console.WriteLine("Number of cameras found: {0}", cameras.Count);
foreach(var camera in cameras)
{
Console.WriteLine("Camera Info: {0}", camera.Info);
}
// DOCTAG-END-LIST-CAMERAS
}
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Environment.ExitCode = 1;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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>{6117292F-5426-48A7-91FB-B801126E576E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>PrintVersionInfo</RootNamespace>
<AssemblyName>PrintVersionInfo</AssemblyName>
<TargetFrameworkVersion>v4.6.1</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;CODE_ANALYSIS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</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>
</ItemGroup>
<ItemGroup>
<Compile Include="PrintVersionInfo.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
@@ -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("PrintVersionInfo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PrintVersionInfo")]
[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("6117292f-5426-48a7-91fb-b801126e576e")]

// 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")]
6 changes: 6 additions & 0 deletions source/ZividNETSamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraUserData", "Camera\In
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetCameraIntrinsics", "Camera\InfoUtilOther\GetCameraIntrinsics\GetCameraIntrinsics.csproj", "{A4F8D63B-E3E9-48DD-A950-276245BACE7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintVersionInfo", "Camera\InfoUtilOther\PrintVersionInfo\PrintVersionInfo.csproj", "{6117292F-5426-48A7-91FB-B801126E576E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadIterateZDF", "Applications\Basic\FileFormats\ReadIterateZDF\ReadIterateZDF.csproj", "{C25D92EB-0C72-4A00-A8A1-7E459F1299A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZDF2PLY", "Applications\Basic\FileFormats\ZDF2PLY\ZDF2PLY.csproj", "{04599908-D437-435E-AE21-2DA7A91BF174}"
Expand Down Expand Up @@ -85,6 +87,10 @@ Global
{A4F8D63B-E3E9-48DD-A950-276245BACE7B}.Debug|x64.Build.0 = Debug|x64
{A4F8D63B-E3E9-48DD-A950-276245BACE7B}.Release|x64.ActiveCfg = Release|x64
{A4F8D63B-E3E9-48DD-A950-276245BACE7B}.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
{6117292F-5426-48A7-91FB-B801126E576E}.Release|x64.Build.0 = Release|x64
{C25D92EB-0C72-4A00-A8A1-7E459F1299A5}.Debug|x64.ActiveCfg = Debug|x64
{C25D92EB-0C72-4A00-A8A1-7E459F1299A5}.Debug|x64.Build.0 = Debug|x64
{C25D92EB-0C72-4A00-A8A1-7E459F1299A5}.Release|x64.ActiveCfg = Release|x64
Expand Down

0 comments on commit b9d58ea

Please sign in to comment.