Beispiel #1
0
        /// <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();
        }
Beispiel #2
0
        /// <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);
                }
        }
Beispiel #3
0
 public DetectorWrapper(FaceDetectionType type)
 {
     this.detector = FaceDetectorFactory.Create(type);
     this.Type = type;
 }
Beispiel #4
0
        /// <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();
        }
Beispiel #5
0
 public DetectorWrapper(FaceDetectionType type)
 {
     this.detector = FaceDetectorFactory.Create(type);
     this.Type     = type;
 }