Skip to content

Getting Started

Adwyzz (OLED Edition) edited this page Dec 5, 2021 · 6 revisions

First of all, install the SeeShark NuGet package:

On the Visual Studio Package Manager Console:

PM> Install-Package SeeShark

or on the .NET CLI:

dotnet add package SeeShark

Start by adding a reference to SeeShark at the top of the file, like so:

using SeeShark;

In order to enumerate all the cameras plugged into the PC you use the CameraManager class.

var manager = new CameraManager();

The devices will be listed under manager.Devices.

After you have chosen your device, you can instantiate it using

Camera camera = manager.GetCamera(CameraInfo info);

Note: both CameraManager and Camera implement IDisposable, so remember to dispose them after use by calling Dispose().

Then, you can listen to the OnFrame event that will be called whenever a frame is available, creating the OnFrameEventHandler() method.

camera.OnFrame += OnFrameEventHandler;

void OnFrameEventHandler(object sender, FrameEventArgs e)
{
    // Here you will be using your camera frames.
}

The frame will be in e.Frame.

After you start listening to the event, you can start the capture with

camera.StartCapture();

After you got the frames, you might want to actually use them. For that, you can look into Saving images.