【问题标题】:Google Mobile Vision TextRecognizer not working on deviceGoogle Mobile Vision TextRecognizer 无法在设备上运行
【发布时间】:2018-05-13 16:27:59
【问题描述】:

我正在从 Android 相机读取文本 模拟器,但它不适用于我的 Android 设备。

这里,TextRecognizer 返回 false,我的应用程序没有继续运行

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

设备的所有权限都已打开,但应用程序无法在两个不同的设备上运行 LG-安卓版本 7.0 三星-Android 4.2.1 版

请帮帮我!

【问题讨论】:

    标签: c# android xamarin xamarin.android


    【解决方案1】:

    您永远不会在您的 TextRecognizer 实例上创建/设置 OCR 处理器。完成此操作后,Google Play 服务也可以将正确的模型下载到设备上(如果它们尚不可用)。

    textRecognizer.SetProcessor(new OcrDetectorProcessor(_GraphicOverlay));
    

    您需要继承Detector.Processor 并实现ReceiveDetections(覆盖)方法。

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 2016-07-07
    • 1970-01-01
    • 2016-12-18
    • 2015-10-01
    相关资源
    最近更新 更多