예제 #1
0
		public static CIDetector CreateFaceDetector (CIContext context, FaceDetectorAccuracy? accuracy = null, float? minFeatureSize = null, bool? trackingEnabled = null)
		{
			List<NSObject> keys = new List<NSObject> (3);
			List<NSObject> values = new List<NSObject> (3);

			if (accuracy != null) {
				keys.Add (Accuracy);
				values.Add (accuracy == FaceDetectorAccuracy.High ? AccuracyHigh : AccuracyLow);
			}

			// MinFeatureSize exists only in iOS6+, before this the field is null (and would throw if used)
			if (MinFeatureSize != null && minFeatureSize != null) {
				keys.Add (MinFeatureSize);
				values.Add (new NSNumber (minFeatureSize.Value));
			}

			// Tracking exists only in iOS6+, before this the field is null (and would throw if used)
			if (Tracking != null && trackingEnabled != null) {
				keys.Add (Tracking);
				values.Add (NSObject.FromObject (true));
			}

			using (var options = NSDictionary.FromObjectsAndKeys (values.ToArray (), keys.ToArray ()))
				return FromType (TypeFace, context, options);
		}
예제 #2
0
        public static CIDetector CreateFaceDetector(CIContext context, FaceDetectorAccuracy? accuracy = null, float? minFeatureSize = null, bool? trackingEnabled = null)
        {
            CIDetectorOptions dopt = new CIDetectorOptions () {
                Accuracy = accuracy,
                MinFeatureSize = minFeatureSize,
                TrackingEnabled = trackingEnabled
            };

            using (var options = dopt.ToDictionary ())
                return FromType (TypeFace, context, options);
        }
예제 #3
0
        public static CIDetector CreateFaceDetector(CIContext context, FaceDetectorAccuracy? accuracy = null, float? minFeatureSize = null, bool? trackingEnabled = null)
        {
            List<NSObject> keys = new List<NSObject> (3);
            List<NSObject> values = new List<NSObject> (3);

            if (accuracy != null) {
                keys.Add (Accuracy);
                values.Add (accuracy == FaceDetectorAccuracy.High ? AccuracyHigh : AccuracyLow);
            }

            if (minFeatureSize != null) {
                keys.Add (MinFeatureSize);
                values.Add (new NSNumber (minFeatureSize.Value));
            }

            if (trackingEnabled != null) {
                keys.Add (Tracking);
                values.Add (NSObject.FromObject (true));
            }

            using (var options = NSDictionary.FromObjectsAndKeys (values.ToArray (), keys.ToArray ()))
                return FromType (TypeFace, context, options);
        }