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(); } }
/// <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 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 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; }
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(); } }