xw.OpenCvSharp4.YuNet 4.11.0

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

xw.OpenCvSharp4.YuNet

为 OpenCvSharp4 补上 cv::FaceDetectorYN(YuNet)人脸检测能力。OpenCvSharp 托管层没有暴露 FaceDetectorYN,本包通过自建原生桥接层直接调用 OpenCV 4.11 的 objdetect 模块,并随包附带官方 YuNet ONNX 模型。

安装

dotnet add package xw.OpenCvSharp4.YuNet --version 4.11.0

支持 netstandard2.0、net48、net6.0、net8.0、net9.0、net10.0,原生库为 win-x64。

用法

using OpenCvSharp;
using OpenCvSharp.YuNet;

using var image = Cv2.ImRead("photo.jpg");
using var detector = FaceDetectorYN.CreateFromBundledModel(new Size(image.Width, image.Height));

foreach (var face in detector.Detect(image))
{
    Console.WriteLine($"{face.BBox} score={face.Score:F3} rightEye={face.RightEye}");
}

也可以指定自己的模型:

using var detector = new FaceDetectorYN(
    "face_detection_yunet_2023mar.onnx", null,
    new Size(image.Width, image.Height),
    scoreThreshold: 0.9f, nmsThreshold: 0.3f, topK: 5000);
  • 检测时若图像尺寸与 InputSize 不一致,会自动同步为图像尺寸。
  • 支持 8/16/32 位、1/3/4 通道输入,内部统一转换为 8UC3。
  • FaceDetection 包含 BBox、5 个关键点(RightEye / LeftEye / Nose / RightMouthCorner / LeftMouthCorner)和 Score。

随包模型

models/face_detection_yunet_2023mar.onnx(232,589 字节,SHA-256 8f2383e4dd3cfbb4553ea8718107fc0423210dc964f9f4280604804ed2552fa4),来自 opencv_zoo,Apache-2.0。

许可

  • 本包:Apache-2.0
  • OpenCV 4.11:Apache-2.0
  • YuNet 模型:Apache-2.0(opencv_zoo)
  • 静态链接组件:BSD-3-Clause(ittnotify、Protocol Buffers)、Zlib

完整第三方声明见包内 THIRD-PARTY-NOTICES.txt、OpenCV-LICENSE.txt、OpenCV-Zoo-LICENSE.txt。

本包为非官方扩展,与 OpenCvSharp、OpenCV、腾讯无隶属关系。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  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

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
4.11.0 69 11/29/2026