横版文字检测

返回文档图片中可能存在文字的区域列表,每个区域由[x1,y1,x2,y2,x3,y3,x4,y4]共4个顶点构成,顶点的顺序按照左上角,右上角,右下角,左下角排序。v1版本仅支持从左到右检测识别横向文档。

请求URL

POST /v1/document/text_detect

请求参数

参数名数据类型是否必填描述
imagefile文档图片。目前支持jpg, png, bmp等大部分格式,请注意,请求体的数据格式为FormData 格式。文件大小不超过 10M,图像宽高须介于 50 到 10000(像素)之间。

请求示例

curl --location --request POST 'localhost:8000/api/document/text_detect' \ --header 'Content-Type: multipart/form-data; boundary=--------------------------994702659308423812684350' \ --form 'image=@/data/your-image.jpg'

响应参数

参数名数据类型描述
codeint0代表正常返回,其他返回值详见错误码说明。
dataobject
text_blocksarray文档图片中可能存在文字的区块列表,每个区块由[x1,y1,x2,y2,x3,y3,x4,y4]共4个顶点构成,顶点的顺序按照左上角,右上角,右下角,左下角排序。v1版本仅支持从左到右检测识别横向文档。

响应示例

{
  "code": 0,
  "data": {
    "text_blocks": [
      [
        824,
        3578,
        915,
        3578,
        915,
        3634,
        824,
        3634
      ],
      [
        612,
        3558,
        790,
        3573,
        786,
        3629,
        609,
        3614
      ],
      [
        510,
        3558,
        590,
        3558,
        590,
        3619,
        510,
        3619
      ],
      [
        1920,
        3447,
        2510,
        3483,
        2506,
        3588,
        1916,
        3553
      ],
      [
        575,
        3357,
        2517,
        3573,
        2510,
        3709,
        567,
        3493
      ],
      [
        1818,
        3331,
        2510,
        3377,
        2506,
        3498,
        1814,
        3452
      ],
      [
        2812,
        549,
        3013,
        449,
        3024,
        519,
        2831,
        620
      ],
      [
        2574,
        575,
        3009,
        323,
        3024,
        408,
        2604,
        660
      ]
    ]
  }
}
secure-scanner.net 版权所有@2024 京ICP备2024096961号