OpenCvSharp4 4.13.0.20260308
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
- Visual C++ 2022 Redistributable
- (Windows Server only) Media Foundation:
Install-WindowsFeature Server-Media-Foundation
Linux (Ubuntu and other distributions)
Pre-install the dependency packages needed for OpenCV. Many packages such as libjpeg must be present for OpenCV to work.
See: OpenCV Linux install guide
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 |
| Disabled | contrib, dnn, ml, video, videoio, highgui, stitching, barcode |
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
Showing the top 20 packages that depend on OpenCvSharp4.
| Packages | Downloads |
|---|---|
|
OpenCvSharp4.Windows
OpenCV 4.x wrapper. All-in-one package for Windows users.
|
3 |
|
OpenCvSharp4.Windows
OpenCV 4.x wrapper. All-in-one package for Windows users.
|
2 |
|
OpenCvSharp4.Windows
OpenCV 4.x wrapper. All-in-one package for Windows users.
|
1 |
.NET 8.0
- System.Memory (>= 4.6.3)
.NET Standard 2.0
- System.Memory (>= 4.6.3)
.NET Standard 2.1
- System.Memory (>= 4.6.3)
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
| Version | Downloads | Last updated |
|---|---|---|
| 4.13.0.20260308 | 1 | 03/09/2026 |
| 4.13.0.20260302 | 1 | 03/09/2026 |
| 4.13.0.20260228 | 1 | 03/09/2026 |
| 4.13.0.20260226 | 1 | 02/27/2026 |
| 4.13.0.20260225 | 1 | 02/27/2026 |
| 4.13.0.20260222 | 1 | 02/27/2026 |
| 4.13.0.20260214 | 1 | 02/27/2026 |
| 4.13.0.20260213 | 1 | 02/27/2026 |
| 4.13.0.20260211 | 1 | 02/27/2026 |
| 4.11.0.20250507 | 1 | 02/24/2026 |
| 4.11.0.20250506 | 0 | 05/06/2025 |
| 4.10.0.20241108 | 1 | 03/06/2026 |
| 4.10.0.20241107 | 0 | 11/07/2024 |
| 4.10.0.20240616 | 0 | 06/16/2024 |
| 4.10.0.20240615 | 0 | 06/15/2024 |
| 4.9.0.20240103 | 0 | 01/03/2024 |
| 4.8.0.20230708 | 0 | 07/10/2023 |
| 4.7.0.20230115 | 0 | 01/15/2023 |
| 4.6.0.20220608 | 0 | 06/08/2022 |
| 4.5.5.20211231 | 0 | 12/31/2021 |
| 4.5.3.20211228 | 0 | 12/28/2021 |
| 4.5.3.20211207 | 0 | 12/07/2021 |
| 4.5.3.20211204 | 0 | 12/05/2021 |
| 4.5.3.20210817 | 0 | 08/21/2021 |
| 4.5.3.20210725 | 0 | 07/25/2021 |
| 4.5.2.20210404 | 0 | 04/04/2021 |
| 4.5.1.20210210 | 0 | 02/10/2021 |
| 4.5.1.20210208 | 0 | 02/08/2021 |
| 4.5.1.20210206 | 0 | 02/06/2021 |
| 4.5.1.20210123 | 0 | 01/24/2021 |
| 4.5.1.20201229 | 0 | 12/29/2020 |
| 4.5.1.20201226 | 0 | 12/26/2020 |
| 4.5.0.20201013 | 0 | 10/13/2020 |
| 4.4.0.20200915 | 0 | 09/16/2020 |
| 4.4.0.20200725 | 0 | 07/25/2020 |
| 4.3.0.20200701 | 0 | 07/08/2020 |
| 4.3.0.20200524 | 0 | 05/27/2020 |
| 4.3.0.20200421 | 0 | 04/21/2020 |
| 4.3.0.20200405 | 0 | 04/05/2020 |
| 4.2.0.20200208 | 0 | 02/08/2020 |
| 4.2.0.20200108 | 0 | 01/08/2020 |
| 4.2.0.20191223 | 0 | 12/23/2019 |
| 4.1.1.20191216 | 0 | 12/17/2019 |
| 4.1.1.20191110 | 0 | 11/10/2019 |
| 4.1.1.20191026 | 0 | 10/27/2019 |
| 4.1.1.20191025 | 0 | 10/25/2019 |
| 4.1.1.20191021 | 0 | 10/23/2019 |
| 4.1.1.20191017 | 0 | 10/18/2019 |
| 4.1.0.20190416 | 0 | 04/16/2019 |
| 4.0.1.20190326 | 0 | 03/26/2019 |
| 4.0.0.20190108 | 0 | 01/08/2019 |
| 4.0.0.20181225 | 0 | 12/25/2018 |