elements.getBoundingBox 输出是什么意思? (FirebaseVision,android)

What does the elements.getBoundingBox output mean? (FirebaseVision, android)

在使用 Firebase-MLKit 库提取的元素上使用 getBoundingBox 方法时,它会为您提供如下所示的输出

Rect(0, 0 - 13, 33)

每个单独的数字代表什么?

相关代码

private void processTextRecognitionResults(FirebaseVisionText receipt) {

        List<FirebaseVisionText.TextBlock> blocks = receipt.getTextBlocks();
        List<FirebaseVisionText.Element> elements;
        if (blocks.size() == 0) {
            Toast.makeText(this, "No text found", Toast.LENGTH_SHORT).show();
            return;
        }

        for (int runThroBlocks = 0; runThroBlocks < blocks.size(); runThroBlocks++) {
            List<FirebaseVisionText.Line> lines = blocks.get(runThroBlocks).getLines();
            for (int runThroLines = 0; runThroLines < lines.size(); runThroLines++) {
                elements = lines.get(runThroLines).getElements();
                for (int runThroElemnts = 0; runThroElemnts < elements.size(); runThroElemnts++) {
                    System.out.println("-----BOX-----");
                    System.out.println(elements.get(runThroElemnts).getText());
                    //This line prints the output given above
                    System.out.println(elements.get(runThroElemnts).getBoundingBox());
                    System.out.println("-----BOX-----");

                }
            }
        }

问题写得不好请见谅。这是我第一次写一个 谢谢你的帮助

getBoundingBox()函数returns一个android.graphics.Rect object

打印 elements.get(runThroElemnts).getText() 时调用的 toString implementation 将它们打印为 lefttoprightbottom

    public String toString() {
        StringBuilder sb = new StringBuilder(32);
        sb.append("Rect("); sb.append(left); sb.append(", ");
        sb.append(top); sb.append(" - "); sb.append(right);
        sb.append(", "); sb.append(bottom); sb.append(")");
        return sb.toString();
    }