protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); mPreview = FindViewById <CameraSourcePreview>(Resource.Id.preview); mGraphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); if (savedInstanceState != null) { mIsFrontFacing = savedInstanceState.GetBoolean("IsFrontFacing"); } if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { createCameraSource(); } else { RequestCameraPermission(); } // Create your application here }
public GraphicFaceTracker(GraphicOverlay overlay, CameraSource cameraSource = null, BlueToothConnectionPortable bTArduino = null) { mOverlay = overlay; mFaceGraphic = new FaceGraphic(overlay); mCameraSource = cameraSource; ArduinoConnection = bTArduino; }
public GraphicFaceTracker(GraphicOverlay overlay, CameraSource cameraSource, FaceService faceService) { this.overlay = overlay; this.faceGraphic = new FaceGraphic(overlay); this.cameraSource = cameraSource; this.faceService = faceService; }
/// <summary> /// Initializing graphic elements /// </summary> private void InitView() { mPreview = (LensEnginePreview)FindViewById(Resource.Id.hand_preview); mOverlay = (GraphicOverlay)FindViewById(Resource.Id.hand_overlay); mFacingSwitch = (Button)FindViewById(Resource.Id.handswitch); mFacingSwitch.SetOnClickListener(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); mPreview = FindViewById <CameraSourcePreview>(Resource.Id.preview); mGraphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); var detector = new FaceDetector.Builder(Application.Context).Build(); detector.SetProcessor( new 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 CameraSource.Builder(Application.Context, detector) .SetRequestedPreviewSize(640, 480) .SetFacing(CameraFacing.Back) .SetRequestedFps(30.0f) .Build(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_live_object_analyse); if (savedInstanceState != null) { this.lensType = savedInstanceState.GetInt("lensType"); } this.mPreview = (LensEnginePreview)this.FindViewById(Resource.Id.object_preview); this.mOverlay = (GraphicOverlay)this.FindViewById(Resource.Id.object_overlay); this.CreateObjectAnalyzer(); this.FindViewById(Resource.Id.detect_start).SetOnClickListener(this); mHandler = new ObjectAnalysisHandler(this); // Checking Camera Permissions if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { this.CreateLensEngine(); } else { this.RequestCameraPermission(); } }
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> /// Initialize elements. /// </summary> private void InitView() { mPreviewView = (ImageView)FindViewById(Resource.Id.handstill_previewPane); mGraphicOverlay = (GraphicOverlay)FindViewById(Resource.Id.handstill_previewOverlay); mDetectSync = (Button)FindViewById(Resource.Id.handstill_detect_sync); mDetectSync.SetOnClickListener(this); mDetectAsync = (Button)FindViewById(Resource.Id.handstill_detect_async); mDetectAsync.SetOnClickListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_image_skeleton_analyse); this.previewView = (ImageView)FindViewById(Resource.Id.skeleton_previewPane); this.graphicOverlay = (GraphicOverlay)FindViewById(Resource.Id.skeleton_previewOverlay); this.FindViewById(Resource.Id.skeleton_detect_sync).SetOnClickListener(this); this.FindViewById(Resource.Id.skeleton_detect_async).SetOnClickListener(this); }
public MLObjectGraphic(GraphicOverlay overlay, MLObject MObject) : base(overlay) { this.mObject = MObject; this.boxPaint = new Paint(); this.boxPaint.Color = Color.White; this.boxPaint.SetStyle(Style.Stroke); this.boxPaint.StrokeWidth = MLObjectGraphic.StrokeWidth; this.textPaint = new Paint(); this.textPaint.Color = Color.White; this.textPaint.TextSize = MLObjectGraphic.TextSize; }
public FaceGraphic(GraphicOverlay overlay) : base(overlay) { this.IsRecognized = false; this.textPaint = new Paint() { TextSize = ID_TEXT_SIZE }; this.boxPaint = new Paint(); this.boxPaint.SetStyle(Paint.Style.Stroke); this.boxPaint.StrokeWidth = BOX_STROKE_WIDTH; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Template data TMP_SKELETONS = new float[14, 4] { { 416.6629f, 312.46442f, 101, 0.8042025f }, { 382.3348f, 519.43396f, 102, 0.86383355f }, { 381.0387f, 692.09515f, 103, 0.7551306f } , { 659.49194f, 312.24445f, 104, 0.8305682f }, { 693.5356f, 519.4844f, 105, 0.8932837f }, { 694.0054f, 692.4169f, 106, 0.8742422f } , { 485.08786f, 726.8787f, 107, 0.6004682f }, { 485.02808f, 935.4897f, 108, 0.7334503f }, { 485.09384f, 1177.127f, 109, 0.67240065f } , { 623.7807f, 726.7474f, 110, 0.5483011f }, { 624.5828f, 936.3222f, 111, 0.730425f }, { 625.81915f, 1212.2491f, 112, 0.72417295f } , { 521.47363f, 103.95903f, 113, 0.7780853f }, { 521.6231f, 277.2533f, 114, 0.7745689f } }; this.SetContentView(Resource.Layout.activity_live_skeleton_analyse); if (savedInstanceState != null) { this.lensType = savedInstanceState.GetInt("lensType"); } this.mPreview = (LensEnginePreview)this.FindViewById(Resource.Id.skeleton_preview); this.graphicOverlay = (GraphicOverlay)this.FindViewById(Resource.Id.skeleton_overlay); templateImgView = (ImageView)this.FindViewById(Resource.Id.template_imgView); templateImgView.SetImageResource(Resource.Drawable.skeleton_template); similarityTxt = (TextView)this.FindViewById(Resource.Id.similarity_txt); //Create analyzer this.CreateSkeletonAnalyzer(); //Camera switch button Button facingSwitchBtn = (Button)this.FindViewById(Resource.Id.skeleton_facingSwitch); if (Android.Hardware.Camera.NumberOfCameras == 1) { facingSwitchBtn.Visibility = ViewStates.Gone; } facingSwitchBtn.SetOnClickListener(this); //Initialize template data InitTemplateData(); mHandler = new LiveSkeletonHandler(this); if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { this.CreateLensEngine(); } else { this.RequestCameraPermission(); } }
public SkeletonGraphic(GraphicOverlay overlay, IList <MLSkeleton> skeletons) : base(overlay) { this.skeletons = skeletons; circlePaint = new Paint(); circlePaint.Color = Color.Red; circlePaint.SetStyle(Paint.Style.Fill); circlePaint.AntiAlias = true; linePaint = new Paint(); linePaint.Color = Color.Green; linePaint.SetStyle(Paint.Style.Stroke); linePaint.StrokeWidth = 10f; linePaint.AntiAlias = true; }
void bulletGraphic_GraphicCompleted(GraphicOverlay sender) { _parentActor.ParentLevel.pulseMan.StartPulse(endPoint, 200, playerOriginated); if (!hitWall && !_parentActor.IsDead) { hitActor.Fired(); } if (hitWall) { SoundManager.Sonar(); } }
public HandKeypointGraphic(GraphicOverlay overlay, IList <MLHandKeypoints> handKeypoints) : base(overlay) { this.handKeypoints = handKeypoints; Color selectedColor = Color.White; idPaintnew = new Paint(); idPaintnew.Color = Color.Green; idPaintnew.TextSize = 32; rectPaint = new Paint(); rectPaint.Color = selectedColor; rectPaint.SetStyle(Paint.Style.Stroke); rectPaint.StrokeWidth = BoxStrokeWidth; }
public ML3DFaceGraphic(GraphicOverlay overlay, ML3DFace face, Context context) : base(overlay) { this.mContext = context; this.mLFace = face; this.overlay = overlay; LineWidth = Dp2px(this.mContext, 3); this.keypointPaint = new Paint(); this.keypointPaint.Color = (Color.Red); this.keypointPaint.SetStyle(Paint.Style.Fill); this.keypointPaint.TextSize = Dp2px(context, 2); this.boxPaint = new Paint(); this.boxPaint.Color = Color.Blue; this.boxPaint.SetStyle(Paint.Style.Stroke); this.boxPaint.StrokeWidth = ML3DFaceGraphic.LineWidth; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.FaceIdentify); this.cameraPreview = this.FindViewById <CameraSourcePreview>(Resource.Id.preview); this.graphicOverlay = this.FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); var button = (ImageButton)this.FindViewById(Resource.Id.flipButton); button.Click += (sender, args) => { this.isFrontFacing = !this.isFrontFacing; if (this.cameraSource != null) { this.cameraSource.Release(); this.cameraSource = null; } this.CreateCameraSource(); this.StartCameraSource(); }; if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { this.CreateCameraSource(); LiveCamHelper.Init(); LiveCamHelper.GreetingsCallback = (s) => { this.RunOnUiThread(() => Greetings = s); }; LiveCamHelper.FacesDetectedCallback = result => { this.RunOnUiThread(() => CognitiveFacesResult = result); }; this.faceService = new FaceService(); await this.faceService.Initialize(); //using (var stream = File.OpenRead("/data/user/0/CognitiveDemo.Droid/files/CognitivveFrame.png")) //{ // await this.faceService.IdentityFace(stream); //} } else { this.RequestCameraPermission(); } }
public MLSegmentGraphic(LensEnginePreview preview, GraphicOverlay overlay, MLImageSegmentation segmentation, Boolean isFront) : base(overlay) { this.bitmapForeground = segmentation.Foreground; this.isFront = isFront; int width = bitmapForeground.Width; int height = bitmapForeground.Height; int div = overlay.Width - preview.Width; int left = overlay.Width - width + div / 2; // Set the image display area. // Partial display. mDestRect = new Rect(left, 0, overlay.Width - div / 2, height / 2); // All display. // mDestRect = new Rect(0, 0, overlay.Width, overlay.Height); this.resultPaint = new Paint(PaintFlags.AntiAlias); this.resultPaint.FilterBitmap = true; this.resultPaint.Dither = true; }
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; }
public GooglyEyesGraphic(GraphicOverlay overlay) : base(overlay) { //super(overlay); mEyeWhitesPaint = new Paint(); mEyeWhitesPaint.Color = Color.White; mEyeWhitesPaint.SetStyle(Paint.Style.Fill); mEyeLidPaint = new Paint(); mEyeLidPaint.Color = Color.Yellow; mEyeLidPaint.SetStyle(Paint.Style.Fill); mEyeIrisPaint = new Paint(); mEyeIrisPaint.Color = Color.Black; mEyeIrisPaint.SetStyle(Paint.Style.Fill); mEyeOutlinePaint = new Paint(); mEyeOutlinePaint.Color = Color.Black; mEyeOutlinePaint.SetStyle(Paint.Style.Stroke); //mEyeOutlinePaint.setStrokeWidth(5); mEyeOutlinePaint.StrokeWidth = 5.0f; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.face_recognition); BTArduino = new BlueToothConnectionPortable(); mPreview = FindViewById <CameraSourcePreview>(Resource.Id.preview); mGraphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { CreateCameraSource(); LiveCamHelper.Init(); LiveCamHelper.GreetingsCallback = (s) => { RunOnUiThread(() => GreetingsText = s); }; //Task.Run(() => LiveCamHelper.RegisterFaces()); } else { RequestCameraPermission(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_live_face3d_analyse); if (savedInstanceState != null) { this.lensType = savedInstanceState.GetInt("lensType"); } this.mPreview = (LensEnginePreview)this.FindViewById(Resource.Id.preview); this.mGraphicOverlay = (GraphicOverlay)this.FindViewById(Resource.Id.overlay); this.CreateFaceAnalyzer(); this.FindViewById(Resource.Id.facingSwitch).SetOnClickListener(this); //Checking Camera permission if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted) { this.CreateLensEngine(); } else { this.RequestCameraPermission(); } }
public FaceAnalyzerTransactor(GraphicOverlay ocrGraphicOverlay) { this.mGraphicOverlay = ocrGraphicOverlay; }
public GraphicFaceTracker(GraphicOverlay overlay) { mOverlay = overlay; mFaceGraphic = new FaceGraphic(overlay); }
public GraphicBarcodeTracker(GraphicOverlay overlay) { _overlay = overlay; _barcodeGraphic = new BarcodeGraphic(overlay); }
public GraphicBarcodeTrackerFactory(GraphicOverlay overlay) : base() { Overlay = overlay; }
public HandAnalyzerTransactor(LiveHandKeyPointAnalyseActivity mActivity, GraphicOverlay ocrGraphicOverlay) { this.mActivity = mActivity; this.mGraphicOverlay = ocrGraphicOverlay; }
public MLSceneDetectionGraphic(GraphicOverlay overlay, IList <MLSceneDetection> results) : base(overlay) { this.overlay = overlay; this.results = results; }
public GraphicFaceTracker(GraphicOverlay overlay, CameraSource cameraSource = null) { mOverlay = overlay; mFaceGraphic = new FaceGraphic(overlay); mCameraSource = cameraSource; }
public SkeletonAnalyzerTransactor(LiveSkeletonAnalyseActivity skeletonActivity, GraphicOverlay ocrGraphicOverlay) { this.mActivity = skeletonActivity; this.mGraphicOverlay = ocrGraphicOverlay; }