OpenCvSharp4 4.13.0.20260330

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

OpenCvSharp

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

Supported Platforms

Platform Target Framework
.NET 8.0 or later net8.0
.NET Standard 2.1 netstandard2.1
.NET Standard 2.0 netstandard2.0
.NET Framework 4.6.1+ via netstandard2.0
.NET Framework 4.8 direct target (WpfExtensions only)

Target OpenCV version: 4.13.0 (with opencv_contrib)

Quick Start

Windows

dotnet add package OpenCvSharp4.Windows

Linux / Ubuntu

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

For more installation options, see Installation on GitHub.

Requirements

Windows

Linux (Ubuntu and other distributions)

The official OpenCvSharp4.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 (OpenCvSharp4.official.runtime.linux-x64.slim): highgui is disabled; no GTK3 or other GUI dependencies. Suitable for headless and container environments.

Slim Profile

The slim runtime packages (OpenCvSharp4.Windows.Slim, OpenCvSharp4.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();
}

For complex pipelines, use ResourcesTracker to manage multiple resources automatically:

using var t = new ResourcesTracker();

var src = t.T(new Mat("lenna.png", ImreadModes.Grayscale));
var dst = t.NewMat();
Cv2.Canny(src, dst, 50, 200);
var blurred = t.T(dst.Blur(new Size(3, 3)));
t.T(new Window("src image", src));
t.T(new Window("dst image", blurred));
Cv2.WaitKey();

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

Resources

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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 (169)

Showing the top 5 NuGet packages that depend on OpenCvSharp4:

Package Downloads
OpenCvSharp4.Extensions

OpenCvSharp GDI+ extension library.

OpenCvSharp4.Windows

OpenCV 4.x wrapper. All-in-one package for Windows users.

OpenCvSharp4.WpfExtensions

OpenCvSharp WPF extension library.

VL.OpenCV

OpenCV for VL

VisioForge.DotNet.Core.CV

VisioForge CV

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.13.0.20260330 27,536 3/30/2026
4.13.0.20260318 17,390 3/18/2026
4.13.0.20260317 4,291 3/17/2026
4.13.0.20260308 20,271 3/8/2026
4.13.0.20260302 23,093 3/2/2026
4.13.0.20260228 1,878 2/28/2026
4.13.0.20260226 3,394 2/26/2026
4.13.0.20260225 1,668 2/25/2026
4.13.0.20260222 6,478 2/22/2026
4.13.0.20260214 22,808 2/14/2026
4.13.0.20260213 1,579 2/13/2026
4.13.0.20260211 5,178 2/11/2026
4.11.0.20250507 797,950 5/7/2025
4.11.0.20250506 8,553 5/6/2025
4.10.0.20241108 782,512 11/8/2024
4.10.0.20241107 15,249 11/7/2024
4.10.0.20240616 495,507 6/16/2024
4.10.0.20240615 16,015 6/15/2024
4.9.0.20240103 1,947,377 1/3/2024
4.8.0.20230708 790,148 7/10/2023
Loading failed