Skip to content

Repository files navigation

SharpGigE

A simple, modern C#/.NET wrapper for GigE Vision / GenICam industrial cameras.

Grab frames, read/write camera parameters, and handle events in a few lines of idiomatic C#. Built for machine-vision engineers who want to stop fighting vendor SDKs.

NuGet .NET License

⚠️ Status: early preview. The public API is taking shape. Star/watch to follow along.


Why SharpGigE?

Most GigE Vision access from .NET means either a heavy vendor SDK (Basler, IDS, Allied Vision — each different) or a C/C++ library you have to P/Invoke yourself. SharpGigE gives you one small, camera-agnostic surface:

using SharpGigE;

// Discover cameras on the network
foreach (var info in CameraDiscovery.Enumerate())
    Console.WriteLine($"{info.Model} @ {info.IpAddress} ({info.Serial})");

// Open the first one, configure, grab
using var cam = Camera.Open(CameraDiscovery.Enumerate().First());

cam.SetParameter("ExposureTime", 5000.0);   // microseconds
cam.SetParameter("PixelFormat", "Mono8");
cam.Set("Width", 1920);
cam.Set("Height", 1080);

cam.FrameReady += (_, frame) =>
    Console.WriteLine($"Frame #{frame.Id}: {frame.Width}x{frame.Height}, {frame.Data.Length} bytes");

cam.StartGrabbing();
Console.ReadLine();
cam.StopGrabbing();

That's the whole loop. No callbacks-of-callbacks, no manual buffer pools to start.


Features

Free (this repo, MIT)

  • 🔍 Discovery — enumerate GigE Vision devices on the local network
  • 🎥 Grab — start/stop streaming, single-frame acquisition
  • ⚙️ Parameters — typed read/write of GenICam features (ExposureTime, Gain, PixelFormat, ROI…)
  • 📢 Events — FrameReady, Disconnected, Error
  • 📦 Formats — Mono8, Mono16, BayerRG8, RGB8 → convert to byte[] / Span<byte>
  • 🧪 Built-in simulator — develop & test your whole pipeline with no camera (patterns, noise, custom frames)
  • 💾 Frame export — save frames to PGM/PPM with zero image dependencies
  • 🧩 Targets — .NET 6 / .NET 8, Windows & Linux

Pro (commercial) — coming soon

  • 🔗 Multi-camera hardware sync (PTP / trigger chaining)
  • ⚡ Zero-copy high-throughput buffer pipeline
  • 🎯 Hardware trigger helpers & strobe control
  • 🛠️ Priority support & private issue tracker

Pro is sold directly (not through this repo). Interested? Open a Discussion or watch this space.


Install

dotnet add package SharpGigE

Requires a GigE Vision compatible camera on the same subnet. See docs/setup.md for jumbo-frame / firewall tips.


Quick start

See the runnable sample in samples/SharpGigE.Grab:

cd samples/SharpGigE.Grab
dotnet run

With no camera present it runs against the built-in virtual test camera so you can try the API immediately.


No camera? Use the simulator

SharpGigE ships a first-class device simulator so you can build and unit-test a vision pipeline before any hardware arrives — or run it in CI where no camera exists.

Moving-bar pattern (+ noise) SMPTE color bars
Moving bar test pattern Color bars

Actual output from the sample, saved via FrameWriter — no image library required.

using SharpGigE;

var sim = Camera.OpenSimulated(new SimulatorOptions
{
    Width       = 640,
    Height      = 480,
    Format      = PixelFormat.Mono8,
    Pattern     = TestPattern.MovingBar,   // Gradient | Checkerboard | MovingBar | Flat | ColorBars
    NoiseStdDev = 8.0,                     // add reproducible Gaussian noise
    FrameRate   = 60.0
});

var frame = sim.GrabSingle();

// Save it — no ImageSharp / System.Drawing needed.
FrameWriter.Save(frame, "frame");   // -> frame.pgm (mono) / frame.ppm (color)

Or feed your own image bytes so tests run against known input:

var sim = Camera.OpenSimulated(new SimulatorOptions
{
    Width = w, Height = h, Format = PixelFormat.Rgb8,
    CustomFrame = myRgbBytes   // exactly w*h*3 bytes
});

Everything else (discovery, parameters, StartGrabbing, events) behaves identically to a real device, so your code doesn't change when the camera shows up.


Roadmap

  • Discovery + parameter model (preview)
  • Real GigE Vision transport (GVCP/GVSP) — in progress
  • USB3 Vision support
  • NuGet 1.0 release
  • Pro tier launch

Contributing

Issues and PRs welcome. This is an early project — API feedback is especially valuable. See CONTRIBUTING.md.

License

MIT © 2026 — see LICENSE.

The MIT-licensed core is free forever. Commercial Pro modules are separately licensed.

About

A simple, modern C#/.NET wrapper for GigE Vision / GenICam industrial cameras.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages