我如何获得文本的颜色?
How do I get the color of the text?
我一直在使用 Microsoft OCR API,我正在从图像中获取文本,但我想知道文本是否具有特定颜色或具有特定背景颜色。
例如我有下面的图片,我想知道是否有红色的文字
i.e. image
我认为这一行:
string requestParameters = "language=unk&detectOrientation=true";
将帮助我建立我想从图像中接收的参数,所以如果我想知道一行字的颜色。所以我添加了这样的视觉特征:
string requestParameters = "visualFeatures=Color,language=unk&detectOrientation=true";
但这并没有解决问题。
另外:我可以混合使用图像分析中的 uriBase link 和 OCR 中的 uriBase 吗?
目前无法在一次调用中检索颜色信息和 OCR 结果。
您可以尝试使用从 OCR 返回的边界框裁剪原始图像,然后将裁剪后的图像发送到 analyze endpoint 并设置 visualFeatures=color 以获取检测到的文本的颜色信息。
根据documentation,这个api可能的请求参数是:
language, detectOrientation
并且返回的元数据包含这些实体:
orientation, language, regions, lines, words, boundingBox, text
可以将 OCR 算法与另一种计算机视觉算法相结合,以检测 OCR 识别的文本区域中的主色。
我一直在使用 Microsoft OCR API,我正在从图像中获取文本,但我想知道文本是否具有特定颜色或具有特定背景颜色。
例如我有下面的图片,我想知道是否有红色的文字 i.e. image
我认为这一行:
string requestParameters = "language=unk&detectOrientation=true";
将帮助我建立我想从图像中接收的参数,所以如果我想知道一行字的颜色。所以我添加了这样的视觉特征:
string requestParameters = "visualFeatures=Color,language=unk&detectOrientation=true";
但这并没有解决问题。
另外:我可以混合使用图像分析中的 uriBase link 和 OCR 中的 uriBase 吗?
目前无法在一次调用中检索颜色信息和 OCR 结果。
您可以尝试使用从 OCR 返回的边界框裁剪原始图像,然后将裁剪后的图像发送到 analyze endpoint 并设置 visualFeatures=color 以获取检测到的文本的颜色信息。
根据documentation,这个api可能的请求参数是:
language, detectOrientation
并且返回的元数据包含这些实体:
orientation, language, regions, lines, words, boundingBox, text
可以将 OCR 算法与另一种计算机视觉算法相结合,以检测 OCR 识别的文本区域中的主色。