-
-
Save Iyemon-018/3360a19fc2683ff51647777237c71c5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 以下のusing を追加しておく。 | |
// | |
// using GCP.VisionAPI.Sample.Services; | |
// using Google.Cloud.Vision.V1; | |
// | |
Image image = Image.FromFile(fileName); | |
ImageAnnotatorClient client = ImageAnnotatorClient.Create(); | |
// ここで解析結果を取得する。 | |
TextAnnotation response = client.DetectDocumentText(image); | |
Block[] blocks = response.Pages.SelectMany(x => x.Blocks).ToArray(); | |
Paragraph[] paragraphs = blocks.SelectMany(x => x.Paragraphs).ToArray(); | |
Word[] words = paragraphs.SelectMany(x => x.Words).ToArray(); | |
Symbol[] symbols = words.SelectMany(x => x.Symbols).ToArray(); | |
string[] textList = symbols.Select(x => x.Text).ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment