Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of FaceDetector. Once created, the two arguments cannot be changed for this instance.
        /// If using high accuracy, the preprocessImageScale property is set to 1.0, otherwise defaults to 0.125.
        /// </summary>
        /// <param name="useHighAccuracy">Thether to use high accuracy for detection.</param>
        /// <param name="trackFaces">Whether to track faces in live video or successive image detections; available ONLY in iOS 6.0 and later.</param>
        public FaceDetector(bool useHighAccuracy = false, bool trackFaces = false)
        {
            // setup face detector
            var context = CIContext.Context((Dictionary <object, object>)null);
            var opts    = new Dictionary <object, object>();

            opts[CIDetector.Accuracy] = useHighAccuracy ? CIDetector.AccuracyHigh : CIDetector.AccuracyLow;
            opts[CIDetector.Tracking] = trackFaces ? 1 : 0;

            _detector = CIDetector.DetectorOfType(CIDetector.TypeFace, context, opts);

            if (useHighAccuracy)
            {
                preprocessImageScale = 1.0f;
            }
        }