简体   繁体   中英

Google Mobile Vision TextRecognizer not working on device

I'm reading text from Android camera emulator, but it does not work on my Android device.

Here, the TextRecognizer returns false, my application does not continue to run

 protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            cameraView = FindViewById<SurfaceView>(Resource.Id.surface_view);
            textView=FindViewById<TextView>(Resource.Id.text_view);


            TextRecognizer textRecognizer=new TextRecognizer.Builder(ApplicationContext).Build();
            if (!textRecognizer.IsOperational)
            {
                Log.Error("Error","Hata var");

            }
            else
            {
                cameraSource = new CameraSource.Builder(ApplicationContext, textRecognizer)
                    .SetFacing(CameraFacing.Back)
                    .SetRequestedPreviewSize(1280, 1024)
                    .SetRequestedFps(2.0f)
                    .SetAutoFocusEnabled(true)
                    .Build();

                cameraView.Holder.AddCallback(this);
                textRecognizer.SetProcessor(this);
            }
        }

All the permissions for devices are open still the App is not able to run on two different devices LG-Android Version 7.0 Samsung-Android Version 4.2.1

Help me please!

You are never creating/setting the OCR processor on your TextRecognizer instance. Once you do that, the Google Play services will also be able to download the correct models to the device if they are not already available.

textRecognizer.SetProcessor(new OcrDetectorProcessor(_GraphicOverlay));

You will need to subclass Detector.Processor and implement the ReceiveDetections (override) method.

re: https://developers.google.com/android/reference/com/google/android/gms/vision/Detector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM