Click or drag to resize

Camera Class

Interface to one Zivid camera
Inheritance Hierarchy
SystemObject
  Zivid.NETCamera

Namespace:  Zivid.NET
Assembly:  ZividCoreNET (in ZividCoreNET.dll) Version: 0.0.0.0
Syntax
public class Camera : IDisposable

The Camera type exposes the following members.

Constructors
  NameDescription
Public methodCamera
Initializes a new instance of the Camera class
Public methodCamera(Camera*)
Initializes a new instance of the Camera class
Public methodCamera(Camera*)
Initializes a new instance of the Camera class
Top
Properties
  NameDescription
Public propertyComputeDevice
Connect the camera to a given Compute device
Public propertyFirmwareVersion
Firmware version
Public propertyModelName
Model name
Public propertyRevision
Camera revision
Public propertySerialNumber
Serial number of the Zivid camera
Public propertySettings
The current camera settings
Public propertyState
Current camera state
Top
Methods
  NameDescription
Public methodAllocateDeviceCloud
Allocate a new point cloud on the Compute device
Public methodCapture
Capture a single frame
Public methodConnect
Connect to the camera
Public methodDisconnect
Disconnect from the camera and free all resources associated with it
Public methodDispose
Releases all resources used by the Camera
Public methodSetFrameCallback
Set a callback that is executed very time a new frame is ready
Public methodSetSettings
Update the camera settings
Public methodStartLive
Start live (continuous) capturing of frames
Public methodStopLive
Stop live (continuous) capturing of frames
Public methodToString
Get string representation of the camera info
(Overrides ObjectToString.)
Public methodUpdateSettings
Update a batch of camera settings by supplying an update settings delegate
Top
Remarks
See Settings for a list of settings that can be configured in the camera. Capture single frames by calling Capture or start continuous frame recording by using StartLive.
Examples
This example shows how to perform a measurement with a real Zivid camera and save the result to disk
SampleCapture
using System;
using Duration = Zivid.NET.Duration;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            var resultFile = "result.zdf";

            Console.WriteLine("Connecting to camera");
            var camera = zivid.ConnectCamera();

            Console.WriteLine("Adjusting the iris");
            camera.UpdateSettings(s =>
            {
                s.Iris = 22;
                s.ExposureTime = Duration.FromMicroseconds(8333);
                s.Filters.Outlier.Enabled = true;
                s.Filters.Outlier.Threshold = 5;
            });

            Console.WriteLine("Capture a frame");
            var frame = camera.Capture();

            Console.WriteLine("Saving frame to file: " + resultFile);
            frame.Save(resultFile);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
Examples
This example shows how to simulate a measurement with Zivid by reading data from a file
SampleCaptureFromFile
// Please make sure that Zivid sample data has been selected during installation of Zivid software.
// Latest version of Zivid software (including samples) can be found at http://zivid.com/software/.

using System;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            var zdfFile = Zivid.NET.Environment.DataPath + "/MiscObjects.zdf";
            var resultFile = "result.zdf";

            Console.WriteLine("Initializing camera emulation using file: " + zdfFile);
            var camera = zivid.CreateFileCamera(zdfFile);

            Console.WriteLine("Capture a frame");
            var frame = camera.Capture();

            Console.WriteLine("Saving frame to file: " + resultFile);
            frame.Save(resultFile);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
Examples
This example shows how to simulate a capture and visualize the results
SampleCaptureFromFileVis3D
// Please make sure that Zivid sample data has been selected during installation of Zivid software.
// Latest version of Zivid software (including samples) can be found at http://zivid.com/software/.

using System;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            Console.WriteLine("Setting up visualization");
            var visualizer = new Zivid.NET.CloudVisualizer();
            zivid.DefaultComputeDevice = visualizer.ComputeDevice;

            var zdfFile = Zivid.NET.Environment.DataPath + "/MiscObjects.zdf";

            Console.WriteLine("Initializing camera emulation using file: " + zdfFile);
            var camera = zivid.CreateFileCamera(zdfFile);

            Console.WriteLine("Capture a frame");
            var frame = camera.Capture();

            Console.WriteLine("Display the frame");
            visualizer.Show(frame);
            visualizer.ShowMaximized();
            visualizer.ResetToFit();

            Console.WriteLine("Run the visualizer. Block until window closes");
            visualizer.Run();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
Examples
This example shows how to perform a high-dynamic-range (HDR) measurement with Zivid
SampleCaptureHDR
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            Console.WriteLine("Setting up visualization");
            var visualizer = new Zivid.NET.CloudVisualizer();
            zivid.DefaultComputeDevice = visualizer.ComputeDevice;

            Console.WriteLine("Connecting to camera");
            var camera = zivid.ConnectCamera();

            Console.WriteLine("Recording HDR source images");
            var frames = new List<Zivid.NET.Frame>();
            foreach (var iris in new ulong[] { 10, 25, 35 })
            {
                Console.WriteLine("Measure with iris = " + iris);
                camera.UpdateSettings(s =>
                {
                    s.Iris = iris;
                });
                frames.Add(camera.Capture());
            }

            Console.WriteLine("Creating HDR frame");
            var hdrFrame = Zivid.NET.HDR.CombineFrames(frames);

            Console.WriteLine("Display the frame");
            visualizer.ShowMaximized();
            visualizer.Show(hdrFrame);
            visualizer.ResetToFit();

            Console.WriteLine("Run the visualizer. Block until window closes");
            visualizer.Run();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
Examples
This example shows how to simulate a measurement with Zivid by reading data from a file and visualize it in 3D
SampleCaptureLiveVis3D
using System;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            Console.WriteLine("Setting up visualization");
            var visualizer = new Zivid.NET.CloudVisualizer();
            zivid.DefaultComputeDevice = visualizer.ComputeDevice;

            Console.WriteLine("Connecting to camera");
            var camera = zivid.ConnectCamera();

            visualizer.ShowMaximized();

            Console.WriteLine("Starting live capturing of frames");
            var resetToFit = true;
            camera.SetFrameCallback(frame => {
                visualizer.Show(frame);
                if (resetToFit)
                {
                    visualizer.ResetToFit();
                    resetToFit = false;
                }
            });

            camera.StartLive();

            Console.WriteLine("Run the visualizer. Block until window closes");
            visualizer.Run();

            Console.WriteLine("Stopping live capturing");
            camera.StopLive();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
Examples
This example shows how to perform a measurement with a real Zivid camera and visualize the resulting point cloud
SampleCaptureVis3D
using System;

class Program
{
    static void Main()
    {
        try
        {
            var zivid = new Zivid.NET.Application();

            Console.WriteLine("Setting up visualization");
            var visualizer = new Zivid.NET.CloudVisualizer();
            zivid.DefaultComputeDevice = visualizer.ComputeDevice;

            Console.WriteLine("Connecting to camera");
            var camera = zivid.ConnectCamera();

            Console.WriteLine("Adjusting the iris");
            camera.UpdateSettings(s =>
            {
                s.Iris = 22;
            });

            Console.WriteLine("Capture a frame");
            var frame = camera.Capture();

            Console.WriteLine("Display the frame");
            visualizer.Show(frame);
            visualizer.ShowMaximized();
            visualizer.ResetToFit();

            Console.WriteLine("Run the visualizer. Block until window closes");
            visualizer.Run();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            Environment.ExitCode = 1;
        }
    }
}
See Also