Google OCR语言提示 [英] Google OCR language hints
问题描述
它在此处的文档页面上说: https://cloud.google.com/vision /docs/ocr ,您可以指定语言提示以帮助OCR更准确地检测图像中的文本.有人知道我将在代码中指定语言提示的地方吗?我正在使用.net控制台应用程序对其进行编程.
It says on the documentation page here: https://cloud.google.com/vision/docs/ocr that you can specify language hints to help OCR more accurately detect text in the image. Does anyone know where I would specify a language hint in my code? I am programming it using a .net console application.
using Google.Cloud.Vision.V1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
// Instantiates a client
var client = ImageAnnotatorClient.Create();
// Load the image file into memory
var image = Image.FromFile("wakeupcat.jpg");
// Performs label detection on the image file
var response = client.DetectLabels(image);
foreach (var annotation in response)
{
if (annotation.Description != null)
Console.WriteLine(annotation.Description);
}
}
}
}
我似乎无法访问ImageContext类的语言提示属性,因为它是只读的.有没有一种方法可以创建ImageContext来指定语言提示?
I can't seem to access the language hints property of the ImageContext class because it is read only. Is there a way to create an ImageContext where I can specify the language hints?
推荐答案
我遇到了同样的问题并解决了. LanguageHints是列表.您可以添加语言.当然,您也可以添加多种语言.
I had same problem and solved it. LanguageHints is List. You can add language. Of course you can add multiple languages also.
ImageContext imageContext = new ImageContext();
imageContext.LanguageHints.Add("en");
imageContext.LanguageHints.Add("ko");
这篇关于Google OCR语言提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!