Created
June 28, 2016 14:33
-
-
Save sakapon/c6e22843c1ca298d945c451e50034c0e to your computer and use it in GitHub Desktop.
CognitiveSample / ComputerVisionWpf / Recognize text
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 System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Windows; | |
using Microsoft.ProjectOxford.Vision; | |
namespace ComputerVisionWpf | |
{ | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
const string SubscriptionKey = "0123456789abcdef0123456789abcdef"; | |
const string ImageUrl = "https://tempuri.org/temp.jpg"; | |
VisionServiceClient client = new VisionServiceClient(SubscriptionKey); | |
async void RecognizeTextAsync() | |
{ | |
try | |
{ | |
var result = await client.RecognizeTextAsync(ImageUrl); | |
// 認識された単語を取り出します。 | |
var words = result.Regions[0].Lines[0].Words; | |
} | |
catch (Exception ex) | |
{ | |
Debug.WriteLine(ex); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment