/// <summary> /// Constructor /// </summary> public SdkHelper() { foundFace = false; this.Detectors = new FaceDetectionType[] { FaceDetectionType.Haar, FaceDetectionType.Multiview, FaceDetectionType.MultiviewPyramid, }; this.Alignmentors = new FaceAlignmentType[] { FaceAlignmentType.Asm, FaceAlignmentType.NeuralNetwork, }; this.detectorType = this.Detectors.First(); this.alignmentType = this.Alignmentors.First(); }
/// <summary> /// Create face detector /// </summary> /// <param name="type">Face detection algorithm type</param> /// <returns>Face detector</returns> public static IFaceDetector CreateDetector(FaceDetectionType type) { ResourceKey cascadeKey = ResourceKey.Unknown; ResourceKey filterKey = ResourceKey.Unknown; switch (type) { case FaceDetectionType.Frontal: cascadeKey = ResourceKey.FrontalCascade; filterKey = ResourceKey.FrontalPostFilter; break; case FaceDetectionType.Multiview: cascadeKey = ResourceKey.MultiviewCascade; filterKey = ResourceKey.MultiviewPostFilter; break; case FaceDetectionType.MultiviewPyramid: cascadeKey = ResourceKey.MultiviewCascade; filterKey = ResourceKey.MultiviewPostFilter; break; case FaceDetectionType.MultiviewPrefilter: cascadeKey = ResourceKey.MultiviewCascade; filterKey = ResourceKey.MultiviewPostFilter; break; default: throw new ArgumentOutOfRangeException("type", "Unsupported detection algorithm type."); } using (var cs = ResourceManager.GetStream(cascadeKey)) using (var ps = ResourceManager.GetStream(filterKey)) { var detector = FaceDetectorFactory.Create(type, cs, ps); return(detector); } }
public DetectorWrapper(FaceDetectionType type) { this.detector = FaceDetectorFactory.Create(type); this.Type = type; }