OpenCvSharp exposes OpenCV image processing and computer vision routines to .NET with NuGet packages matching OpenCV 4.x or 5.x runtimes.
Overview
OpenCvSharp is a cross-platform .NET binding for OpenCV that keeps APIs close to the native C++ interfaces while applying C# conventions such as typed enums, exceptions, and disposable resource handling.
Packages are split into managed libraries and platform-specific native runtimes for Windows, Linux, and macOS on x64 and arm64, with slim and headless runtime profiles where GTK or GUI modules are omitted. OpenCvSharp4 targets older frameworks including .NET Framework 4.6.1+, while OpenCvSharp5 tracks OpenCV 5.1 on .NET 8+.
Features include Mat lifecycle management, conversions to GDI+ or WPF bitmap types, and support for OpenCL via UMat though not CUDA. A Blazor WebAssembly demo showcases browser-side processing without local installs.
Installation is through NuGet pairs such as OpenCvSharp5 plus the matching official runtime package for each operating system and CPU architecture.
Key features
- OpenCV-aligned .NET API
- OpenCvSharp4 and 5 families
- NuGet runtime packages per OS
- Headless and slim profiles
- IDisposable Mat management
- Bitmap conversion helpers
- Linux manylinux228 binaries
- Blazor WebAssembly demo
Use cases
- .NET computer vision apps
- Cross-platform image processing
- Server-side CV without GUI
- WPF and WinForms imaging