Files
.config
.vscode
BlurHash
BlurHash.Core
BlurHash.System.Drawing.Common
Compare
Copy-Distinct
Date-Group
Delete-By-Distinct
Delete-By-Relative
Distance
Drag-Drop-Explorer
Drag-Drop-Move
Drag-Drop-Search
Drag-Drop-Set-Property-Item
Duplicate-Search
Face
FaceParts
FaceRecognitionDotNet
Dlib
Extensions
FaceDetector.cs
FaceLandmarkDetector.cs
DisposableObject.cs
FaceEncoding.cs
FaceRecognition.cs
FaceRecognitionDotNet.csproj
FaceRecognitionModels.cs
Image.cs
ModelParameter.cs
Point.cs
Instance
Map
Metadata
Metadata-Query
Mirror-Length
Move-By-Id
Offset-Date-Time-Original
PhotoPrism
PrepareForOld
Property
Property-Compare
Rename
Resize
Set-Created-Date
Shared
Tests
TestsWithFaceRecognitionDotNet
ThumbHash
.editorconfig
.gitattributes
.gitignore
.prettierignore
.txt
View-by-Distance-MKLink-Console.sln
package-lock.json
package.json
view-by-distance-mklink-con…/FaceRecognitionDotNet/Extensions/FaceDetector.cs

26 lines
996 B
C#

using DlibDotNet;
using View_by_Distance.Shared.Models;
namespace View_by_Distance.FaceRecognitionDotNet.Extensions;
/// <summary>
/// An abstract base class that provides functionality to detect face locations from image.
/// </summary>
public abstract class FaceDetector : DisposableObject
{
#region Methods
internal IEnumerable<Location> Detect(Image image, int numberOfTimesToUpsample) => RawDetect(image.Matrix, numberOfTimesToUpsample);
/// <summary>
/// Returns an enumerable collection of face location correspond to all faces in specified image.
/// </summary>
/// <param name="matrix">The matrix contains a face.</param>
/// <param name="numberOfTimesToUpsample">The number of times to up-sample the image when finding faces.</param>
/// <returns>An enumerable collection of face location correspond to all faces.</returns>
protected abstract IEnumerable<Location> RawDetect(MatrixBase matrix, int numberOfTimesToUpsample);
#endregion
}