コード例 #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, bool highAccuracy)
		{
			// TypeFace is the only detector supported now
			using (var options = NSDictionary.FromObjectsAndKeys (new NSObject [] { highAccuracy ? AccuracyHigh : AccuracyLow },
									      new NSObject [] { Accuracy }))
				return FromType (TypeFace, context, options);
		}
コード例 #3
0
		public static CIDetector CreateFaceDetector (CIContext context, bool highAccuracy, float minFeatureSize)
		{
			// MinFeatureSize exists only in iOS6+, before this the field is null (and would throw if used)
			if (MinFeatureSize == null)
				return CreateFaceDetector (context, highAccuracy);

			// TypeFace is the only detector supported now
			using (var options = NSDictionary.FromObjectsAndKeys (new NSObject [] { highAccuracy ? AccuracyHigh : AccuracyLow, new NSNumber (minFeatureSize) },
									      new NSObject [] { Accuracy, MinFeatureSize, }))
				return FromType (TypeFace, context, options);
		}
コード例 #4
0
ファイル: CIDetector.cs プロジェクト: jorik041/maccore
        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);
        }
コード例 #5
0
 private void InitializeImagingContext()
 {
     #if MONOTOUCH
     if (ciContext == null)
         ciContext = CIContext.FromOptions(null);
     #else
     if (ciContext == null)
         ciContext = CIContext.FromContext (context);
     #endif
 }