back to home

shimat / opencvsharp

OpenCV wrapper for .NET

5,947 stars
1,221 forks
42 issues
C#C++C

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing shimat/opencvsharp in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/shimat/opencvsharp)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

OpenCvSharp is a cross-platform .NET wrapper for OpenCV, providing a rich set of image processing and computer vision functionality. It supports .NET 8+, .NET Standard 2.0/2.1, and .NET Framework 4.6.1+. Quick Start Windows Linux / Ubuntu For more installation options, see the Installation section below. Features • OpenCvSharp is modeled on the native OpenCV C/C++ API style as much as possible. • Many classes of OpenCvSharp implement IDisposable. Unsafe resources are managed automatically. • OpenCvSharp does not force object-oriented programming style on you. You can also call native-style OpenCV functions. • OpenCvSharp provides functions for converting from to (GDI+) or (WPF). Target OpenCV • OpenCV 4.13.0 with opencv_contrib Requirements • .NET 8 or later / .NET Standard 2.0 / .NET Standard 2.1 • .NET Framework 4.6.1 or later is supported via the .NET Standard 2.0 target (WpfExtensions also directly targets .NET Framework 4.8) • (Windows) Visual C++ 2022 Redistributable Package • (Windows Server) Media Foundation • (Linux) The official package is built on manylinux_2_28 and works on Ubuntu 20.04+, Debian 10+, RHEL/AlmaLinux 8+, and other Linux distributions with glibc 2.28+. The full package includes FFmpeg (LGPL v2.1) and Tesseract statically linked. • The **full** package uses GTK3 for support ( , , etc.). GTK3 is pre-installed on standard Ubuntu/Debian/RHEL environments. In minimal or container environments where it is absent, install it manually ( or ), or use the **slim** profile instead. • The **slim** package ( ) disables and has no GUI dependencies — suitable for headless and container use. **OpenCvSharp won't work on Unity and Xamarin platforms.** For Unity, please consider using OpenCV for Unity or some other solutions. **OpenCvSharp does not support CUDA.** If you want to use CUDA features, you need to customize the native bindings yourself. Installation Windows (except UWP) Add and NuGet packages to your project. Alternatively, you can use the all-in-one package. For a smaller feature profile, pair with , or use the all-in-one package. > ⚠️ ** is deprecated and no longer maintained.** The last published version targets OpenCV 4.9.0. New UWP projects are not recommended; consider migrating to WinUI 3. Linux (Ubuntu and other distributions) Add and NuGet packages to your project. This package uses the portable RID and works with .NET 8+ publish/deploy workflows out of the box. > ⚠️ The distro-specific packages are **no longer maintained**. Use instead. Slim profile module coverage The runtime packages keep a practical subset while reducing runtime dependencies. • Enabled modules: , , , , , , , , , , , • Disabled modules: , , , This profile is used by: • • • Usage For more details, refer to the **samples** and **Wiki** pages. **Always remember to release Mat and other IDisposable resources using the syntax:** Advanced: Using ResourcesTracker for automatic resource management As mentioned above, objects of classes such as Mat and MatExpr have unmanaged resources and need to be manually released by calling the Dispose() method. Additionally, the +, -, *, and other operators create new objects each time, and these objects need to be disposed to prevent memory leaks. Despite having the using syntax, the code can still look verbose. Therefore, a ResourcesTracker class is provided. The ResourcesTracker implements the IDisposable interface, and when the Dispose() method is called, all resources tracked by the ResourcesTracker are disposed. The T() method of ResourcesTracker can track an object or an array of objects, and the NewMat() method is equivalent to T(new Mat(...)). All objects that need to be released can be wrapped with T(). For example: t.T(255 - t.T(picMat * 0.8)). Example code is as follows: Code samples https://github.com/shimat/opencvsharp_samples/ API Documents http://shimat.github.io/opencvsharp/api/OpenCvSharp.html NuGet Managed libraries | Package | Description | |---------|-------------| |**OpenCvSharp4**| OpenCvSharp core libraries | |**OpenCvSharp4.Extensions**| GDI+ Extensions | |**OpenCvSharp4.WpfExtensions**| WPF Extensions | |**OpenCvSharp4.Windows**| All-in-one package for Windows (except UWP) | |**OpenCvSharp4.Windows.Slim**| All-in-one slim package for Windows (except UWP) | Native bindings | Package | Description | |---------|-------------| |**OpenCvSharp4.runtime.win**| Native bindings for Windows x64 (except UWP) | |**OpenCvSharp4.runtime.win.slim**| Slim native bindings for Windows x64 (except UWP), with enabled | |**OpenCvSharp4.official.runtime.linux-x64**| Native bindings for Linux x64 (portable RID, recommended). Built on manylinux_2_28. Includes FFmpeg and Tesseract statically linked. Requires GTK3 runtime ( ) for highgui ( etc.). | |**OpenCvSharp4.official.runtime.linux-x64.slim**| Slim native bindings for Linux x64 (portable RID), with enabled. No external runtime dependencies. | |**OpenCvSharp4.runtime.linux-arm**| Native bindings for Linux Arm | |**OpenCvSharp4.runtime.wasm**| Native bindings for WebAssembly | > **Note:** Windows x86 (32-bit) support has been dropped as of the OpenCV 4.13.0 release series. > The and packages now ship **x64-only** native binaries. > Users requiring x86 Windows support should stay on the last OpenCV 4.12.x-based packages. Native binding (OpenCvSharpExtern.dll / libOpenCvSharpExtern.so) is required for OpenCvSharp to work. To use OpenCvSharp, you should add both and packages to your project. Currently, native bindings for Windows, Linux x64/ARM, and WebAssembly are available. Packages named OpenCvSharp3-* and OpenCvSharp-* are deprecated. > OpenCvSharp3-AnyCPU / OpenCvSharp3-WithoutDll / OpenCvSharp-AnyCPU / OpenCvSharp-WithoutDll Downloads If you are not using NuGet, you can download the DLL files from the release page. Docker images https://github.com/shimat?tab=packages OpenCvSharp Build Instructions Windows Prerequisites • Visual Studio 2022 / 2026, or the corresponding…