【发布时间】:2018-02-16 01:35:48
【问题描述】:
我正在使用Computer Vision API C# Quick Start 提供的示例 我能够获得示例中所示的 JSON 结果,但无法仅获得文本内容。
JSON 示例格式如下:
{
"textAngle": 0.020943951023932542,
"orientation": "NotDetected",
"language": "de",
"regions": [
{
"boundingBox": "46,54,59,71",
"lines": [
{
"boundingBox": "48,54,49,19",
"words": [
{
"boundingBox": "48,54,49,19",
"text": "Hello"
}
]
},
{
"boundingBox": "46,106,59,19",
"words": [
{
"boundingBox": "46,106,59,19",
"text": "World"
}
]
}
]
}
]
}
目前,我正在使用 JSON 转换器通过使用下面的类结构为每个单词添加换行符来提取文本节点。
public class Region
{
public string BoundingBox { get; set; }
public List<Line> Lines { get; set; }
}
public class Line
{
public string BoundingBox { get; set; }
public List<Word> Words { get; set; }
}
public class Word
{
public string BoundingBox { get; set; }
public string Text { get; set; }
}
API 中是否提供了任何请求参数来获取响应本身中的直接文本?
【问题讨论】:
-
你可以使用这个类github.com/Microsoft/Cognitive-Vision-DotNetCore/blob/master/…作为替代,不确定API
标签: c# computer-vision ocr microsoft-cognitive azure-cognitive-services