/// <summary> /// Set the recognition parameters, call the recognizer capture interface for recognition, /// and the recognition result will be returned through the callback function. /// </summary> /// <param name="Callback">The callback of bank cards analyse.</param> private void StartCaptureActivity(MLBcrCaptureCallback Callback) { MLBcrCaptureConfig config = new MLBcrCaptureConfig.Factory() // Set the expected result type of bank card recognition. .SetResultType(MLBcrCaptureConfig.ResultAll) // Set the screen orientation of the plugin page. .SetOrientation(MLBcrCaptureConfig.OrientationAuto) .Create(); MLBcrCapture bcrCapture = MLBcrCaptureFactory.Instance.GetBcrCapture(config); bcrCapture.CaptureFrame(this, Callback); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_image_bcr_analyse); this.mTextView = (Android.Widget.TextView)FindViewById(Resource.Id.text_result); this.previewImage = (Android.Widget.ImageView) this.FindViewById(Resource.Id.Bank_Card_image); this.previewImage.SetScaleType(ImageView.ScaleType.FitXy); this.FindViewById(Resource.Id.detect).SetOnClickListener(this); this.previewImage.SetOnClickListener(this); this.banCallback = new MLBcrCaptureCallback(this); this.customViewButton = (Button)FindViewById(Resource.Id.custom_view_button); this.customViewButton.SetOnClickListener(this); //Checking permissions if (!(ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted)) { this.requestPermissions(); } if (!(ActivityCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) == Android.Content.PM.Permission.Granted)) { this.requestPermissions(); } }