protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.FaceTracker); mPreview = FindViewById <CameraSourcePreview> (Resource.Id.preview); mGraphicOverlay = FindViewById <GraphicOverlay> (Resource.Id.faceOverlay); var detector = new Android.Gms.Vision.Faces.FaceDetector.Builder(Application.Context).Build(); detector.SetProcessor( new Android.Gms.Vision.MultiProcessor.Builder(new GraphicFaceTrackerFactory(mGraphicOverlay)).Build()); if (!detector.IsOperational) { // Note: The first time that an app using face API is installed on a device, GMS will // download a native library to the device in order to do detection. Usually this // completes before the app is run for the first time. But if that download has not yet // completed, then the above call will not detect any faces. // // isOperational() can be used to check if the required native library is currently // available. The detector will automatically become operational once the library // download completes on device. Android.Util.Log.Warn(TAG, "Face detector dependencies are not yet available."); } mCameraSource = new Android.Gms.Vision.CameraSource.Builder(Application.Context, detector) .SetRequestedPreviewSize(640, 480) .SetFacing(Android.Gms.Vision.CameraFacing.Back) .SetRequestedFps(30.0f) .Build(); }
public FaceGraphic(GraphicOverlay overlay) : base(overlay) { mCurrentColorIndex = (mCurrentColorIndex + 1) % COLOR_CHOICES.Length; var selectedColor = COLOR_CHOICES[mCurrentColorIndex]; mFacePositionPaint = new Paint(); mFacePositionPaint.Color = selectedColor; mIdPaint = new Paint(); mIdPaint.Color = selectedColor; mIdPaint.TextSize = ID_TEXT_SIZE; mBoxPaint = new Paint(); mBoxPaint.Color = selectedColor; mBoxPaint.SetStyle(Paint.Style.Stroke); mBoxPaint.StrokeWidth = BOX_STROKE_WIDTH; }
public GraphicFaceTracker(GraphicOverlay overlay) { mOverlay = overlay; mFaceGraphic = new FaceGraphic(overlay); }
public GraphicFaceTrackerFactory(GraphicOverlay overlay) : base() { Overlay = overlay; }
public GraphicBarcodeTracker(GraphicOverlay overlay) { mOverlay = overlay; mBarcodeGraphic = new BarcodeGraphic(overlay); }
public void Start(CameraSource cameraSource, GraphicOverlay overlay) { mOverlay = overlay; Start(cameraSource); }
public Graphic(GraphicOverlay overlay) { mOverlay = overlay; }