예제 #1
0
 public GraphicFaceTracker(int id, EventHandler <OnPictureTakenEventArgs> onPictureTaken, GraphicOverlay overlay, CameraSource cameraSource = null)
 {
     this.id             = id;
     mOverlay            = overlay;
     mFaceGraphic        = new FaceGraphic(overlay);
     mCameraSource       = cameraSource;
     this.onPictureTaken = onPictureTaken;
 }
예제 #2
0
        public FaceGraphic(GraphicOverlay overlay) : base(overlay)
        {
            mCurrentColorIndex = (mCurrentColorIndex + 1) % COLOR_CHOICES.Length;
            var selectedColor = COLOR_CHOICES[mCurrentColorIndex];

            mFacePositionPaint = new Paint()
            {
                Color = selectedColor
            };
            mIdPaint = new Paint()
            {
                Color    = selectedColor,
                TextSize = ID_TEXT_SIZE
            };
            mBoxPaint = new Paint()
            {
                Color = selectedColor
            };
            mBoxPaint.SetStyle(Paint.Style.Stroke);
            mBoxPaint.StrokeWidth = BOX_STROKE_WIDTH;
        }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            FaceCameraService.CancelRequested += CancellationRequested;

            var b = (savedInstanceState ?? Intent.Extras);

            id = b.GetInt(ExtraId, 0);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.FaceCamera);

            mPreview        = FindViewById <CameraSourcePreview>(Resource.Id.preview);
            mGraphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay);

            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted)
            {
                CreateCameraSource();
            }
            else
            {
                RequestCameraPermission();
            }
        }
예제 #4
0
 public void Start(CameraSource cameraSource, GraphicOverlay overlay)
 {
     mOverlay = overlay;
     Start(cameraSource);
 }