The class for analysis result.
コード例 #1
0
        public static CelebrityAnalysisResult AnalyzeImageForCelebrities(Bitmap sourceImage)
        {
            VisionServiceClient VisionServiceClient = ComputerVisionService.GetClient();

            using (MemoryStream memoryStream = new MemoryStream())
            {
                sourceImage.SaveAsPng(memoryStream);
                memoryStream.Position = 0;

                Console.WriteLine("Calling VisionServiceClient.AnalyzeImageInDomainAsync()...");

                // This is how you'd recognize celebrities like Henry Clay
                Microsoft.ProjectOxford.Vision.Contract.AnalysisInDomainResult result = VisionServiceClient.AnalyzeImageInDomainAsync(memoryStream, "celebrities").GetAwaiter().GetResult();

                Newtonsoft.Json.Linq.JObject jsonObj = result.Result as Newtonsoft.Json.Linq.JObject;

                CelebrityAnalysisResult celebResult = jsonObj.ToObject <CelebrityAnalysisResult>() as CelebrityAnalysisResult;
                return(celebResult);
            }
        }
コード例 #2
0
 /// <summary>
 /// Log the result of an analysis in domain result
 /// </summary>
 /// <param name="result"></param>
 protected void LogAnalysisInDomainResult(AnalysisInDomainResult result)
 {
     if (result.Metadata != null)
     {
         Log("Image Format : " + result.Metadata.Format);
         Log("Image Dimensions : " + result.Metadata.Width + " x " + result.Metadata.Height);
     }
     
     if (result.Result != null)
     {
         Log("Result : " + result.Result.ToString());
     }
 }