Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.FaceTracker);

            _cameraSourcePreview = FindViewById <CameraSourcePreview>(Resource.Id.cameraSourcePreview);
            _overlay             = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay);

            var detector = new FaceDetector.Builder(Application.Context)
                           //.SetTrackingEnabled(false)
                           .SetLandmarkType(LandmarkDetectionType.All)
                           .SetMode(FaceDetectionMode.Accurate)
                           .Build();

            detector.SetProcessor(
                new MultiProcessor.Builder(new FaceTrackerFactory(_overlay)).Build());

            _cameraSource = new CameraSource.Builder(this, detector)
                            .SetAutoFocusEnabled(true)
                            //.SetRequestedPreviewSize(640, 480)
                            .SetFacing(CameraFacing.Front)
                            .SetRequestedFps(30.0f)
                            .Build();
        }
Exemple #2
0
 /// <summary>
 /// カメラ起動
 /// </summary>
 /// <param name="cameraSource"></param>
 /// <param name="overlay"></param>
 public void Start(CameraSource cameraSource, GraphicOverlay overlay)
 {
     // パラメータ設定
     _overlay      = overlay;
     _cameraSource = cameraSource;
     // フラグオン
     _startRequested = true;
     // カメラ起動
     Start();
 }
Exemple #3
0
        public FaceGraphic(GraphicOverlay overlay) : base(overlay)
        {
            colorIndex = (colorIndex + 1) % COLOR_CHOICES.Length;
            var selectedColor = COLOR_CHOICES[colorIndex];

            _facePositionPaint       = new Paint();
            _facePositionPaint.Color = selectedColor;

            _idPaint          = new Paint();
            _idPaint.Color    = selectedColor;
            _idPaint.TextSize = ID_TEXT_SIZE;

            _boxPaint       = new Paint();
            _boxPaint.Color = selectedColor;
            _boxPaint.SetStyle(Paint.Style.Stroke);
            _boxPaint.StrokeWidth = BOX_STROKE_WIDTH;
        }
Exemple #4
0
 public FaceTracker(GraphicOverlay overlay)
 {
     _overlay     = overlay;
     _faceGraphic = new FaceGraphic(overlay);
 }
Exemple #5
0
 public FaceTrackerFactory(GraphicOverlay overlay)
     : base()
 {
     Overlay = overlay;
 }
Exemple #6
0
 public Graphic(GraphicOverlay overlay)
 {
     _overlay = overlay;
 }