OpenCvSharp4.Windows 4.13.0.20260627
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
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 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
highguisupport (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):highguiis 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 (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
No packages depend on OpenCvSharp4.Windows.
.NET Framework 4.8
- OpenCvSharp4 (>= 4.13.0.20260627)
- OpenCvSharp4.WpfExtensions (>= 4.13.0.20260627)
- OpenCvSharp4.runtime.win (>= 4.13.0.20260627)
.NET 8.0
- OpenCvSharp4 (>= 4.13.0.20260627)
- OpenCvSharp4.WpfExtensions (>= 4.13.0.20260627)
- OpenCvSharp4.runtime.win (>= 4.13.0.20260627)
.NET Standard 2.0
- OpenCvSharp4 (>= 4.13.0.20260627)
- OpenCvSharp4.runtime.win (>= 4.13.0.20260627)
.NET Standard 2.1
- OpenCvSharp4 (>= 4.13.0.20260627)
- OpenCvSharp4.runtime.win (>= 4.13.0.20260627)
| Version | Downloads | Last updated |
|---|---|---|
| 4.13.0.20260627 | 1 | 07/02/2026 |
| 4.13.0.20260602 | 1 | 06/14/2026 |
| 4.13.0.20260531 | 1 | 06/14/2026 |
| 4.13.0.20260528 | 1 | 06/14/2026 |
| 4.13.0.20260302 | 2 | 05/14/2026 |
| 4.13.0.20260228 | 3 | 05/14/2026 |
| 4.13.0.20260226 | 3 | 05/14/2026 |
| 4.13.0.20260225 | 3 | 05/14/2026 |
| 4.13.0.20260222 | 3 | 05/14/2026 |
| 4.13.0.20260214 | 3 | 05/14/2026 |
| 4.13.0.20260213 | 3 | 05/14/2026 |
| 4.13.0.20260211 | 3 | 05/14/2026 |
| 4.11.0.20250507 | 2 | 05/14/2026 |
| 4.11.0.20250506 | 3 | 05/14/2026 |
| 4.10.0.20241108 | 5 | 05/13/2026 |
| 4.10.0.20241107 | 3 | 05/14/2026 |
| 4.10.0.20240616 | 3 | 05/14/2026 |
| 4.10.0.20240615 | 3 | 05/14/2026 |
| 4.9.0.20240103 | 3 | 05/14/2026 |
| 4.8.0.20230708 | 3 | 05/14/2026 |
| 4.7.0.20230115 | 3 | 05/14/2026 |
| 4.6.0.20220608 | 3 | 05/14/2026 |
| 4.5.5.20211231 | 2 | 05/14/2026 |
| 4.5.3.20211228 | 3 | 05/14/2026 |
| 4.5.3.20211207 | 3 | 05/14/2026 |
| 4.5.3.20211204 | 3 | 05/14/2026 |
| 4.5.3.20210817 | 3 | 05/14/2026 |
| 4.5.3.20210725 | 3 | 05/14/2026 |
| 4.5.2.20210404 | 3 | 05/14/2026 |
| 4.5.1.20210210 | 3 | 05/14/2026 |
| 4.5.1.20210208 | 3 | 05/14/2026 |
| 4.5.1.20210206 | 3 | 05/14/2026 |
| 4.5.1.20210123 | 3 | 05/14/2026 |
| 4.5.1.20201229 | 3 | 05/14/2026 |
| 4.5.1.20201226 | 3 | 05/14/2026 |
| 4.5.0.20201013 | 3 | 05/14/2026 |
| 4.4.0.20200915 | 3 | 05/14/2026 |
| 4.4.0.20200725 | 3 | 05/14/2026 |
| 4.3.0.20200701 | 3 | 05/14/2026 |
| 4.3.0.20200524 | 2 | 05/14/2026 |
| 4.3.0.20200421 | 3 | 05/14/2026 |
| 4.3.0.20200405 | 3 | 05/14/2026 |
| 4.2.0.20200208 | 3 | 05/14/2026 |
| 4.2.0.20200108 | 4 | 05/14/2026 |
| 4.2.0.20191223 | 4 | 05/14/2026 |
| 4.1.1.20191216 | 3 | 05/14/2026 |
| 4.1.1.20191110 | 3 | 05/14/2026 |
| 4.1.1.20191026 | 3 | 05/14/2026 |
| 4.1.1.20191025 | 3 | 05/14/2026 |
| 4.1.1.20191021 | 3 | 05/14/2026 |
| 4.1.1.20191017 | 3 | 05/14/2026 |
| 4.1.0.20190416 | 3 | 05/14/2026 |
| 4.0.1.20190326 | 3 | 05/14/2026 |
| 4.0.0.20190108 | 3 | 05/14/2026 |
| 4.0.0.20181225 | 3 | 05/14/2026 |