public MLFaceGraphic(GraphicOverlay overlay, MLFace face) : base(overlay) { this.mFace = face; this.overlay = overlay; Color selectedColor = Color.White; this.facePositionPaint = new Paint(); this.facePositionPaint.Color = selectedColor; this.textPaint = new Paint(); this.textPaint.Color = Color.White; this.textPaint.TextSize = (24); this.textPaint.SetTypeface(Typeface.Default); this.probilityPaint = new Paint(); this.probilityPaint.Color = Color.White; this.probilityPaint.TextSize = (35); this.probilityPaint.SetTypeface(Typeface.Default); this.landmarkPaint = new Paint(); this.landmarkPaint.Color = Color.Red; this.landmarkPaint.SetStyle(Paint.Style.Fill); this.landmarkPaint.StrokeWidth = (10f); this.boxPaint = new Paint(); this.boxPaint.Color = Color.White; this.boxPaint.SetStyle(Paint.Style.Stroke); this.boxPaint.StrokeWidth = (MLFaceGraphic.BoxStrokeWidth); this.facePaint = new Paint(); this.facePaint.Color = (Color.ParseColor("#ffcc66")); this.facePaint.SetStyle(Paint.Style.Stroke); this.facePaint.StrokeWidth = (MLFaceGraphic.LineWidth); this.eyePaint = new Paint(); this.eyePaint.Color = (Color.ParseColor("#00ccff")); this.eyePaint.SetStyle(Paint.Style.Stroke); this.eyePaint.StrokeWidth = (MLFaceGraphic.LineWidth); this.eyebrowPaint = new Paint(); this.eyebrowPaint.Color = (Color.ParseColor("#006666")); this.eyebrowPaint.SetStyle(Paint.Style.Stroke); this.eyebrowPaint.StrokeWidth = (MLFaceGraphic.LineWidth); this.nosePaint = new Paint(); this.nosePaint.Color = (Color.ParseColor("#ffff00")); this.nosePaint.SetStyle(Paint.Style.Stroke); this.nosePaint.StrokeWidth = (MLFaceGraphic.LineWidth); this.noseBasePaint = new Paint(); this.noseBasePaint.Color = (Color.ParseColor("#ff6699")); this.noseBasePaint.SetStyle(Paint.Style.Stroke); this.noseBasePaint.StrokeWidth = (MLFaceGraphic.LineWidth); this.lipPaint = new Paint(); this.lipPaint.Color = (Color.ParseColor("#990000")); this.lipPaint.SetStyle(Paint.Style.Stroke); this.lipPaint.StrokeWidth = (MLFaceGraphic.LineWidth); }
/// <summary> /// Display result in TextView /// </summary> private void DisplaySuccess(MLFace mFace) { DecimalFormat decimalFormat = new DecimalFormat("0.000"); string result = "Left eye open Probability: " + decimalFormat.Format(mFace.Features.LeftEyeOpenProbability); result += "\nRight eye open Probability: " + decimalFormat.Format(mFace.Features.RightEyeOpenProbability); result += "\nMoustache Probability: " + decimalFormat.Format(mFace.Features.MoustacheProbability); result += "\nGlass Probability: " + decimalFormat.Format(mFace.Features.SunGlassProbability); result += "\nHat Probability: " + decimalFormat.Format(mFace.Features.HatProbability); result += "\nAge: " + mFace.Features.Age; result += "\nGender: " + ((mFace.Features.SexProbability > 0.5f) ? "Female" : "Male"); result += "\nRotationAngleY: " + decimalFormat.Format(mFace.RotationAngleY); result += "\nRotationAngleZ: " + decimalFormat.Format(mFace.RotationAngleZ); result += "\nRotationAngleX: " + decimalFormat.Format(mFace.RotationAngleX); this.mTextView.Text = (result); }