首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >谷歌视觉数字识别

谷歌视觉数字识别
EN

Stack Overflow用户
提问于 2018-04-19 15:56:16
回答 1查看 69关注 0票数 1

我必须创建一个数独解算器,所以我使用谷歌视觉创建了一个数字识别,用于从grid.This数字识别中检索数字修剪网格以分析每个单元格,但识别不起作用。我认为问题来自于TextRecognizer,他在识别单个字符方面有困难。

你能帮帮我吗?

谢谢。

代码语言:javascript
运行
复制
btnProcess.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            new Thread(new Runnable() {
                public void run() {
                    final StringBuilder stringBuilder = new StringBuilder();
                    TextRecognizer textRecognizer=new TextRecognizer.Builder(getApplicationContext()).build();
                    if(!textRecognizer.isOperational()){
                        Log.e("Error","Detector not available");
                    }
                    else {
                        int largeur = (bitmap.getWidth()) / 9;
                        int hauteur = (bitmap.getHeight()) / 9;
                        Bitmap cellule = null;
                        for (int y = 0; y< 9; y++) {
                            for (int x = 0; x < 9; x++) {
                                cellule = Bitmap.createBitmap(bitmap,x*largeur,y*hauteur,largeur,hauteur);
                                Frame frame = new Frame.Builder().setBitmap(cellule).build();
                                cellule.recycle();
                                SparseArray<TextBlock> items = textRecognizer.detect(frame);
                                if (items.size()==0){
                                    stringBuilder.append("0" + " ");
                                }
                                else{
                                    TextBlock item=items.valueAt(0);
                                    stringBuilder.append(item.getValue() + " ");
                                }

                            }
                            stringBuilder.append("\n");
                        }
                    }
                    runOnUiThread(new Runnable() {
                        public void run() {
                            txtResult.setText(stringBuilder.toString());
                        }
                    });
                }
            }).start();

        };
    });
EN

回答 1

Stack Overflow用户

发布于 2020-11-09 17:47:09

你说你用的是谷歌视觉的OCR?您可以在以下位置测试google vision api:

https://cloud.google.com/vision/

在:

试用接口

只需导入您的图像,并查看API是否识别这些数字。只是为了排除使用Google Vision检测这些数字的能力或无能为力。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49915680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档