PDF / TIFF文档文本检测-BoundingBox

时间:2019-01-25 11:34:22

标签: google-vision

如何从PDF / TIFF文档文本检测的JSON响应中创建可搜索文本PDF。

此外,如何将BoundingBox顶点转换为顶部,左侧,宽度和高度。

来自JSON的响应如下:

{
  "boundingBox": {
    "normalizedVertices": [
      {
        "x": 0.14478114,
        "y": 0.046428572
      },
      {
        "x": 0.2777778,
        "y": 0.046428572
      },
      {
        "x": 0.2777778,
        "y": 0.06666667
      },
      {
        "x": 0.14478114,
        "y": 0.06666667
      }
    ]
  },
  "symbols": [
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "R",
      "confidence": 0.99
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "e",
      "confidence": 1
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "l",
      "confidence": 0.99
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "i",
      "confidence": 0.99
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "a",
      "confidence": 0.99
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "n",
      "confidence": 1
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ]
      },
      "text": "c",
      "confidence": 1
    },
    {
      "property": {
        "detectedLanguages": [
          {
            "languageCode": "en"
          }
        ],
        "detectedBreak": {
          "type": "EOL_SURE_SPACE"
        }
      },
      "text": "e",
      "confidence": 1
    }
  ],
  "confidence": 0.99
}

0 个答案:

没有答案