Last active
June 28, 2016 14:28
-
-
Save sakapon/54dc433f50dec38b25676a676d8cbdec to your computer and use it in GitHub Desktop.
CognitiveSample / ComputerVisionWpf / Analyze image
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 AnalyzeImageAsync() | |
{ | |
try | |
{ | |
var result = await client.AnalyzeImageAsync(ImageUrl, (VisualFeature[])Enum.GetValues(typeof(VisualFeature))); | |
// 各情報を取り出します。 | |
var captions = result.Description.Captions; | |
var isAdultContent = result.Adult.IsAdultContent; | |
} | |
catch (Exception ex) | |
{ | |
Debug.WriteLine(ex); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment