CvInspect.Imaging.Gev 0.22.0

dotnet add package CvInspect.Imaging.Gev --version 0.22.0
                    
NuGet\Install-Package CvInspect.Imaging.Gev -Version 0.22.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CvInspect.Imaging.Gev" Version="0.22.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CvInspect.Imaging.Gev" Version="0.22.0" />
                    
Directory.Packages.props
<PackageReference Include="CvInspect.Imaging.Gev" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CvInspect.Imaging.Gev --version 0.22.0
                    
#r "nuget: CvInspect.Imaging.Gev, 0.22.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CvInspect.Imaging.Gev@0.22.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CvInspect.Imaging.Gev&version=0.22.0
                    
Install as a Cake Addin
#tool nuget:?package=CvInspect.Imaging.Gev&version=0.22.0
                    
Install as a Cake Tool

CvInspect.Imaging.Gev

ci NuGet CvInspect.Imaging.Gev License: Apache-2.0

GigE camera acquisition for the CvInspect machine-vision toolkit — an ICam backend that speaks the protocol directly, so no vendor SDK and no proprietary DLLs are needed.

Status. Verified against real hardware, with no vendor SDK and no vendor filter driver installed on any of the machines. Two monochrome cameras from different vendors are discovered, opened, streamed and stopped on a bench, and a pair of colour cameras acquires on an inspection line, where the Bayer path produced the right colour with nothing pinned and nothing tuned. That is hours of run time, not months. The eight-hour figures quoted further down were measured on the GigE transport this package streams through, not through this ICam layer — the transport carried 1.46 TB without losing a packet, but nothing has run this backend for that long. Treat other cameras as unproven.

Use

CamFactory.Register("GigE", opt => new GevCam(opt, new GevCamOpt
{
    XmlCacheDir = cacheDir,        // second Open skips the camera XML transfer
    BufferCount = 8,
}));

var cam = CamFactory.Create(new CamOpt
{
    ComType = "GigE",
    SerialNumber = "12345678",     // cameras are bound by serial, not by address
    ExposureTimeUs = 8000,
    UserSettings = "UserSet1",     // loaded on open when set
});

cam.FrameAcquired += (_, frame) => { using var mat = frame.AsMat(); /* inspect */ };
cam.Open();
cam.StartContinuous();

Wrap it in ReconnectingCam to survive link drops:

var cam = new ReconnectingCam(() => CamFactory.Create(camOpt));

Why serial numbers

Addresses move — DHCP hands them out, and a camera that fails to get a lease falls back to a link-local address. Serial numbers do not. When the camera is not found, the exception lists every device that answered, with its serial, model, address, the host NIC that heard it, and whether the two share a subnet — enough to tell a network problem from a wrong serial from an addressing problem without going to the machine.

Pixel formats

Mono 8/10/12/16, Bayer 8/10/12/16 (all four phases), RGB8, BGR8, RGBa8, BGRa8, and the packed mono formats. Everything is folded to the toolkit's 8-bit frame types; packed data is folded directly without a 16-bit intermediate. Formats that cannot be represented are dropped with a warning rather than delivered wrong.

Bayer phase

Camera-side mirroring (ReverseX/ReverseY) and an odd ROI offset shift the start of the 2×2 colour-filter tile, which changes the effective pattern — and the standard does not require the camera to update its reported PixelFormat when that happens. Getting it wrong swaps red and blue with no error at all.

This package does not force its own calculation, because firmware that already compensates would then be corrected twice. It uses the camera's declaration, and when the geometry implies a different pattern it logs both so the mismatch is visible. On the colour cameras run so far the declared pattern was the right one — colour came out correct with nothing pinned and no disagreement logged. If colours are wrong, pin the pattern:

new GevCamOpt { BayerPatternOverride = CvBayerPattern.GR }

Health

GevCam.GetHealth() returns one atomic snapshot of the acquisition counters — completed and incomplete frames, frames dropped for want of a buffer, missing packets, resend activity, and frames whose device sequence number never arrived. Reading the fields separately would mix moments and manufacture events that never happened, so they come together or not at all.

The snapshot names its own camera and device address. Snapshots travel — into a log line, a list, a message to something upstream — and a number that cannot say which of eight cameras it describes answers nothing when one of them goes bad.

The counters are cumulative since the stream started; subtract two snapshots to get your own window rather than one this package picked for you. Compare StreamStartedUtc before subtracting — a reconnect restarts the counters, and a consumer computing deltas across that boundary sees negative numbers.

Alarm on MissingPackets and IncompleteFrames, never on ResendRequests. Packets that arrive out of order but still in time leave a resend request behind with nothing actually lost — an eight-hour two-camera bench run of the protocol library logged 6,392 requests against zero missing packets, and raising the timeouts does not reduce it. The rule is what that run settled; it was measured on the transport, not through this package.

Diagnostics

Attach CvLog.Sink before opening — discovery results, feature fallbacks, dropped frames and Bayer-phase disagreements all go there. The gevprobe sample in this repository opens a camera, records what it declares, saves a frame, and runs a timed acquisition; it is the quickest way to find out what a specific camera does.

A debugger that pauses the process drops the camera. A breakpoint, Break All, or a memory snapshot stops the heartbeat, and once it has been quiet for the device's heartbeat timeout — a few seconds — the device takes control back. Every call after that throws GevControlLostException and only reopening recovers. The exception says how long the gap was, so a stall of tens of seconds against a timeout of three names itself; a loss with no gap at all points at another application taking the channel, or at the device restarting.

What makes this cost time is how it looks. A live view goes on showing the frame it already had, so nothing on screen changes; the loss surfaces at the next operation that actually uses the control channel, which is usually a grab. The grab then looks like the cause of a camera that died much earlier — in one case 53 minutes earlier. Subscribe to ICam.ConnectionChanged if you want to see it when it happens rather than when something else trips over it.

Targets

netstandard2.1 and net8.0. Depends on CvInspect.Imaging and on the GigE protocol library; neither pulls in a native OpenCV runtime — the consuming application still chooses that.

License

Apache-2.0. Not affiliated with OpenCV, OpenCvSharp, or any camera vendor.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.22.0 0 9/11/2026
0.21.0 39 9/10/2026
0.20.0 44 9/10/2026
0.19.0 58 9/9/2026 0.19.0 is deprecated because it has critical bugs.
0.18.0 71 9/8/2026 0.18.0 is deprecated because it has critical bugs.
0.17.0 63 9/8/2026 0.17.0 is deprecated because it has critical bugs.