【问题标题】:Android ML Kit Firebase FirebaseVisionText , `block.getCornerPoints() `always `return null` valuesAndroid ML Kit Firebase FirebaseVisionText,`block.getCornerPoints()`总是`return null`值
【发布时间】:2019-03-12 05:07:25
【问题描述】:

Android ML Kit Firebase FirebaseVisionText,block.getCornerPoints() 始终为 return null 值。如何在 firebase 中读取文本 polygon corner 点。

成功响应代码块

 List<FirebaseVisionText.TextBlock> blocks = text.getTextBlocks();
    for (int i = 0; i < blocks.size(); i++) {
        Log.d(TAG, "onSuccess: block corner points: " + blocks.get(i).getCornerPoints());

        List<FirebaseVisionText.Line> lines = blocks.get(i).getLines();
        for (int j = 0; j < lines.size(); j++) {
            Log.d(TAG, "onSuccess: line corner points: " + lines.get(j).getCornerPoints());
            List<FirebaseVisionText.Element> elements = lines.get(j).getElements();
            for (int l = 0; l < elements.size(); l++) {
                Log.d(TAG, "onSuccess: element corner points: " + elements.get(l).getCornerPoints());
                CloudTextGraphic cloudTextGraphic = new CloudTextGraphic(graphicOverlay,
                        elements.get(l));
                graphicOverlay.add(cloudTextGraphic);
            }
        }
    } 

【问题讨论】:

    标签: android image-processing firebase-mlkit


    【解决方案1】:

    首先实例化 Point[] 引用:

    Point[] elementCornerPoints = elements.get(l).getCornerPoints();
    

    现在得到一个元素的 4 个角点:

    for(int p=0 ; p<elementCornerPoints.length; p++){
    
        Log.d(TAG, "onSuccess: element corner points: " + elementCornerPoints[p]);
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多