hongmao.HmExtension.Face
1.0.1.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package hongmao.HmExtension.Face --version 1.0.1.6
NuGet\Install-Package hongmao.HmExtension.Face -Version 1.0.1.6
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="hongmao.HmExtension.Face" Version="1.0.1.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add hongmao.HmExtension.Face --version 1.0.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: hongmao.HmExtension.Face, 1.0.1.6"
#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.
// Install hongmao.HmExtension.Face as a Cake Addin #addin nuget:?package=hongmao.HmExtension.Face&version=1.0.1.6 // Install hongmao.HmExtension.Face as a Cake Tool #tool nuget:?package=hongmao.HmExtension.Face&version=1.0.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
虹猫信息扩展包-人脸识别模块
1. 介绍
虹猫信息扩展包-人脸识别模块是虹猫信息扩展包的一个子模块,主要用于人脸识别功能的实现。该模块基于虹软人脸识别SDK,实现了人脸识别功能,支持人脸检测、人脸特征提取、人脸比对等功能。
2. 功能
- 人脸检测
- 标记关键点
- 人脸特征提取
- 人脸比对
- 人脸注册
- 人脸删除
- 人脸搜索
3. 使用
3.1. 人脸检测
using HmExtension.Face;
public class FaceDetectExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var faceInfos =await FaceHelper.Detect(bitmap);
foreach (var faceInfo in faceInfos)
{
Console.WriteLine($"人脸位置: {faceInfo.Location}");
}
}
}
3.2. 标记关键点
using HmExtension.Face;
public class FaceLandmarkExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var faceInfos =await FaceHelper.Detect(bitmap);
foreach (var faceInfo in faceInfos)
{
var faceMarkPoints = await FaceHelper.FaceMark(bitmap, faceInfo);
foreach (var faceMarkPoint in faceMarkPoints)
{
Console.WriteLine($"关键点: {faceMarkPoint}");
}
}
}
}
3.3. 人脸特征提取
using HmExtension.Face;
public class FaceFeatureExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var faceInfos =await FaceHelper.Detect(bitmap);
foreach (var faceInfo in faceInfos)
{
var faceMarkPoints = await FaceHelper.FaceMark(bitmap, faceInfo);
var extract = FaceHelper.Extract(bitmap, faceMarkPoints);
Console.WriteLine($"人脸特征: {extract}");
}
}
}
3.4. 人脸比对
using HmExtension.Face;
public class FaceCompareExample
{
public static async void Main(string[] args){
var bitmap1 = new Bitmap("test1.jpg");
var bitmap2 = new Bitmap("test2.jpg");
// 方法1
Compare1(bitmap1,bitmap2);
// 方法2
Compare2(bitmap1,bitmap2);
// 方法3
Compare3(bitmap1,bitmap2);
// 方法4
Compare4(bitmap1,bitmap2);
}
// 方法1
public void Compare1(Bitmap bitmap1,Bitmap bitmap2){
var faceInfos1 =await FaceHelper.Detect(bitmap1);
var faceInfos2 =await FaceHelper.Detect(bitmap2);
// 标记关键点
var faceMarkPoints1 = await FaceHelper.FaceMark(bitmap1, faceInfo1[0]);
var faceMarkPoints2 = await FaceHelper.FaceMark(bitmap1, faceInfo2[0]);
// 提取特征
var extract1 = FaceHelper.Extract(bitmap1, faceMarkPoints1);
var extract2 = FaceHelper.Extract(bitmap2, faceMarkPoints2);
var score = FaceHelper.Compare(extract1, extract2);
Console.WriteLine($"人脸相似度: {score}");
}
// 方法2
public void Compare2(Bitmap bitmap1,Bitmap bitmap2){
var score = FaceHelper.Compare(bitmap1, bitmap2);
Console.WriteLine($"人脸相似度: {score}");
}
// 方法3
public void Compare3(Bitmap bitmap1,Bitmap bitmap2){
var faceInfos1 =await FaceHelper.Detect(bitmap1);
var faceInfos2 =await FaceHelper.Detect(bitmap2);
// 标记关键点
var faceMarkPoints1 = await FaceHelper.FaceMark(bitmap1, faceInfo1[0]);
var faceMarkPoints2 = await FaceHelper.FaceMark(bitmap1, faceInfo2[0]);
// 提取特征
var extract1 = FaceHelper.Extract(bitmap1, faceMarkPoints1);
var extract2 = FaceHelper.Extract(bitmap2, faceMarkPoints2);
// 检查是否是同一个人
var isSamePerson =await FaceHelper.IsSelf(extract1, extract2);
}
// 方法4
public void Compare4(Bitmap bitmap1,Bitmap bitmap2){
var isSamePerson = FaceHelper.IsSelf(bitmap1, bitmap2);
}
}
3.5. 人脸注册
using HmExtension.Face;
public class FaceRegisterExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var key = await RegisterFace(bitmap, "test");
}
}
3.6. 人脸删除
using HmExtension.Face;
public class FaceDeleteExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var key = await RegisterFace(bitmap, "test");
FaceHelper.RemoveFace(key);
}
}
3.7. 人脸搜索
using HmExtension.Face;
public class FaceSearchExample
{
public static async void Main(string[] args){
var bitmap = new Bitmap("test.jpg");
var key = await RegisterFace(bitmap, "test");
var result =await FaceHelper.Match(bitmap);
Console.WriteLine($"人脸搜索结果: {result}");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.1
- hongmao.HmExtension.Commons (>= 1.0.1.4)
- hongmao.HmExtension.Drawing (>= 1.0.1.4)
- ViewFaceCore (>= 0.3.8)
- ViewFaceCore.Extension.SystemDrawing (>= 0.3.7)
- ViewFaceCore.model.face_detector (>= 6.0.7)
- ViewFaceCore.model.face_landmarker_mask_pts5 (>= 6.0.7)
- ViewFaceCore.model.face_landmarker_pts5 (>= 6.0.7)
- ViewFaceCore.model.face_landmarker_pts68 (>= 6.0.7)
- ViewFaceCore.model.face_recognizer_light (>= 6.0.7)
- ViewFaceCore.runtime.win.x64 (>= 6.0.7)
- ViewFaceCore.runtime.win.x86 (>= 6.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1. 修改人脸搜索方法名称
2. 新增使用教程