Пример #1
0
        /// <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="myObj"></param>
        /// <param name="callBack">The callback of cards analyse.</param>
        private void StartCaptureActivity(Java.Lang.Object myObj, MLGcrCaptureCallback callBack)
        {
            MLGcrCaptureConfig   cardConfig = new MLGcrCaptureConfig.Factory().Create();
            MLGcrCaptureUIConfig uiConfig   = new MLGcrCaptureUIConfig.Factory()
                                              .SetScanBoxCornerColor(Color.Green)
                                              .SetTipText("Recognizing, align edges")
                                              .SetOrientation(MLGcrCaptureUIConfig.OrientationAuto).Create();
            MLGcrCapture ocrManager = MLGcrCaptureFactory.Instance.GetGcrCapture(cardConfig, uiConfig);

            ocrManager.CapturePreview(this, myObj, callBack);
        }
Пример #2
0
        /// <summary>
        /// Detect input card bitmap.
        /// </summary>
        /// <param name="bitmap"></param>
        /// <param name="myObj"></param>
        /// <param name="callback"></param>
        private void StartLocalImageActivity(Bitmap bitmap, Java.Lang.Object myObj, MLGcrCaptureCallback callback)
        {
            if (bitmap == null)
            {
                this.mTextView.Text = "No card image to recognition.";
                return;
            }
            MLGcrCaptureConfig config     = new MLGcrCaptureConfig.Factory().Create();
            MLGcrCapture       ocrManager = MLGcrCaptureFactory.Instance.GetGcrCapture(config);

            ocrManager.CaptureImage(bitmap, myObj, callback);
        }
Пример #3
0
        /// <summary>
        /// Use the plug-in to take a picture of the card and recognize.
        /// </summary>
        /// <param name="myObj"></param>
        /// <param name="callback"></param>
        private void StartTakePhotoActivity(Java.Lang.Object myObj, MLGcrCaptureCallback callback)
        {
            MLGcrCaptureConfig   cardConfig = new MLGcrCaptureConfig.Factory().Create();
            MLGcrCaptureUIConfig uiConfig   = new MLGcrCaptureUIConfig.Factory()
                                              .SetScanBoxCornerColor(Color.Blue)
                                              .SetTipText("Taking EEP to HK/Macau picture")
                                              .SetOrientation(MLGcrCaptureUIConfig.OrientationAuto).Create();
            // Create a general card identification processor using the custom interface.
            MLGcrCapture ocrManager = MLGcrCaptureFactory.Instance.GetGcrCapture(cardConfig, uiConfig);

            // Create a general card identification processor using the default interface.
            // MLGcrCapture ocrManager = MLGcrCaptureFactory.Instance.GetGcrCapture(cardConfig);

            ocrManager.CapturePhoto(this, myObj, callback);
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.SetContentView(Resource.Layout.activity_image_gcr_analyse);
            this.mTextView    = (Android.Widget.TextView)FindViewById(Resource.Id.text_result);
            this.previewImage = (Android.Widget.ImageView)FindViewById(Resource.Id.Card_image);
            this.previewImage.SetOnClickListener(this);
            this.previewImage.SetScaleType(ImageView.ScaleType.FitXy);
            this.FindViewById(Resource.Id.detect_picture_HKID).SetOnClickListener(this);
            this.FindViewById(Resource.Id.detect_picture_homeCard).SetOnClickListener(this);
            this.FindViewById(Resource.Id.detect_picture_passCard).SetOnClickListener(this);
            this.FindViewById(Resource.Id.detect_video_HKID).SetOnClickListener(this);
            this.FindViewById(Resource.Id.detect_video_homeCard).SetOnClickListener(this);
            this.FindViewById(Resource.Id.detect_video_passCard).SetOnClickListener(this);

            this.callback = new MLGcrCaptureCallback(this);
            //Checking Camera permission
            if (!(ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted))
            {
                this.RequestCameraPermission();
            }
        }