我想将表单识别器“boundingBox”的结果转换为图像坐标,以可视化覆盖图像和识别的数据。 然而,boundingBox 结果看起来不像这个图像那样的 XY 坐标位置。 /image/DOEi5.png
我需要每个boundingBox的左上(X1,Y1)和右下(X2,Y2)计算规则。
我还使用认知服务 OCR 和文本识别制定了一些计算规则,但没有有关表单识别器的信息。 我试图通过减号或除号找到 XY 坐标规则,但没有找到规则。
这是我通过表单识别器的示例图像获得的结果 json 数据。但无法从中找到boundingBox规则。
Responsebody: {
'status': 'success',
'pages': [
{
'number': 1,
'height': 792,
'width': 612,
'clusterId': 0,
'keyValuePairs': [
{
'key': [
{
'text': 'Address:',
'boundingBox': [
57.3,
683.0,
100.5,
683.0,
100.5,
673.7,
57.3,
673.7
]
}
],
'value': [
{
'text': '1020 Enterpirse Way.',
'boundingBox': [
57.3,
672.2,
153.1,
672.2,
153.1,
658.8,
57.3,
658.8
],
'confidence': 0.53
},
我需要每个boundingBox的左上(X1,Y1)和右下(X2,Y2)计算规则。
感谢团队。
最佳答案
我在使用表单识别器时也遇到过这种困惑。它的原点位于页面左下角。
// Azure Bounding box is like this 0---->1
// | |
// Y | |
// ↑ 3<----2
// Origin . → X
// Expected Bounding Box Origin . → X
// ↓ 0---->1
// Y | |
// | ↓
// 3<----2
这八个值是4个点的X、Y值。您可以选择左上角为 0th、1st,右下角为 4th、5th。 如果您想标准化坐标,使值保持在 0 和 1 之间,则必须将每个像素值除以相应页面的宽度和高度。
关于Azure 表单识别器边界框结果转换为 XY 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56209331/