OpenCvSharp5.Windows 5.0.0.20260702

Prefix Reserved
dotnet add package OpenCvSharp5.Windows --version 5.0.0.20260702
                    
NuGet\Install-Package OpenCvSharp5.Windows -Version 5.0.0.20260702
                    
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="OpenCvSharp5.Windows" Version="5.0.0.20260702" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenCvSharp5.Windows" Version="5.0.0.20260702" />
                    
Directory.Packages.props
<PackageReference Include="OpenCvSharp5.Windows" />
                    
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 OpenCvSharp5.Windows --version 5.0.0.20260702
                    
#r "nuget: OpenCvSharp5.Windows, 5.0.0.20260702"
                    
#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 OpenCvSharp5.Windows@5.0.0.20260702
                    
#: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=OpenCvSharp5.Windows&version=5.0.0.20260702
                    
Install as a Cake Addin
#tool nuget:?package=OpenCvSharp5.Windows&version=5.0.0.20260702
                    
Install as a Cake Tool

OpenCvSharp

A cross-platform .NET wrapper for OpenCV, providing image processing and computer vision functionality.

This is the OpenCvSharp5 family (OpenCV 5.x, .NET 8+). If you need .NET Framework, Unity, or another pre-.NET 8 runtime, use the OpenCvSharp4 family (OpenCV 4.13.0) instead.

Supported Platforms

Platform Target Framework
.NET 8.0 or later net8.0
Windows desktop (.NET 8+) net8.0-windows (WpfExtensions)

Target OpenCV version: 5.0.x (with opencv_contrib)

Quick Start

Windows

dotnet add package OpenCvSharp5.Windows

Linux / Ubuntu

dotnet add package OpenCvSharp5
dotnet add package OpenCvSharp5.official.runtime.linux-x64

macOS

dotnet add package OpenCvSharp4
# Intel (x64):
dotnet add package OpenCvSharp4.runtime.osx.x64
# Apple Silicon (arm64):
dotnet add package OpenCvSharp4.runtime.osx.arm64

For more installation options, see Installation on GitHub.

Requirements

Windows

  • (Windows Server only) Media Foundation:
    Install-WindowsFeature Server-Media-Foundation
    

Linux (Ubuntu and other distributions)

The official OpenCvSharp5.official.runtime.linux-x64 package is built on manylinux_2_28 (glibc 2.28) and works on Ubuntu 20.04+, Debian 10+, RHEL/AlmaLinux 8+, and other Linux distributions.

  • Full package: uses GTK3 for highgui support (Cv2.ImShow, Cv2.WaitKey, etc.). GTK3 (libgtk-3.so.0) is pre-installed on standard Ubuntu/Debian/RHEL environments and typically requires no action. In minimal or container environments where GTK3 is absent, install it manually: Ubuntu/Debian: apt-get install libgtk-3-0; RHEL/AlmaLinux: dnf install gtk3. Alternatively, use the slim package which has no GUI dependencies.
  • Slim package (OpenCvSharp5.official.runtime.linux-x64.slim): highgui is disabled; no GTK3 or other GUI dependencies. Suitable for headless and container environments.

macOS (Intel and Apple Silicon)

The OpenCvSharp4.runtime.osx.x64 and OpenCvSharp4.runtime.osx.arm64 packages provide native bindings for macOS. FFmpeg, Tesseract, Freetype, and all standard OpenCV modules are statically linked.

Slim Profile

The slim runtime packages (OpenCvSharp5.Windows.Slim, OpenCvSharp5.official.runtime.linux-x64.slim, etc.) bundle a smaller native library:

Modules
Enabled core, imgproc, imgcodecs, calib3d, features2d, flann, objdetect, photo, ml, video, stitching, barcode
Disabled contrib, dnn, videoio, highgui

Usage

Always release Mat and other IDisposable resources using the using statement:

using OpenCvSharp;

// Edge detection using Canny algorithm
using var src = new Mat("lenna.png", ImreadModes.Grayscale);
using var dst = new Mat();

Cv2.Canny(src, dst, 50, 200);
using (new Window("src image", src))
using (new Window("dst image", dst))
{
    Cv2.WaitKey();
}

Mat arithmetic operators (+, -, *, /, comparisons, bitwise, T(), Inv(), ...) return a lazily-evaluated managed expression tree that holds no unmanaged resources, so chained expressions never leak. Just receive the result in a using Mat:

using var src = new Mat("lenna.png", ImreadModes.Grayscale);

// The intermediate (src * 0.8) holds no native resource; nothing leaks.
using Mat dst = 255 - src * 0.8;

Note: OpenCvSharp does not support Unity, Xamarin, CUDA or UWP.

Resources

There are no supported framework assets in this 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
5.0.0.20260702 32 7/2/2026
5.0.0.20260702-beta 33 7/2/2026