public async Task IdentifyCelebrityAsync() { try { if (this.ImageUrl != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync(this.ImageUrl); } else if (this.GetImageStreamCallback != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync(this.GetImageStreamCallback, new VisualFeature[] { VisualFeature.Categories }, new string[] { "Celebrities" }); } } catch (Exception e) { ErrorTrackingHelper.TrackException(e, "Vision API AnalyzeImageAsync error"); this.AnalysisResult = new Microsoft.ProjectOxford.Vision.Contract.AnalysisResult(); if (this.ShowDialogOnFaceApiErrors) { await ErrorTrackingHelper.GenericApiCallExceptionHandler(e, "Vision API failed."); } } }
public async Task IdentifyCelebrityAsync() { try { if (this.ImageUrl != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync(this.ImageUrl); } else if (this.GetImageStreamCallback != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.GetImageStreamCallback, new List <VisualFeatureTypes>() { VisualFeatureTypes.Categories }, new List <Details>() { Details.Celebrities }); } } catch (Exception e) { ErrorTrackingHelper.TrackException(e, "Vision API AnalyzeImageAsync error"); this.AnalysisResult = new ImageAnalysis(); if (this.ShowDialogOnFaceApiErrors) { await ErrorTrackingHelper.GenericApiCallExceptionHandler(e, "Vision API failed."); } } }
public async Task AnalyzeImageAsync(bool detectCelebrities = false, IList <VisualFeatureTypes> visualFeatures = null) { try { if (visualFeatures == null) { visualFeatures = DefaultVisualFeatures; } if (this.ImageUrl != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.ImageUrl, visualFeatures, detectCelebrities?new List <Details> { Details.Celebrities } : null); } else if (this.GetImageStreamCallback != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.GetImageStreamCallback, visualFeatures, detectCelebrities?new List <Details> { Details.Celebrities } : null); } } catch (Exception e) { ErrorTrackingHelper.TrackException(e, "Vision API AnalyzeImageAsync error"); this.AnalysisResult = new ImageAnalysis(); if (this.ShowDialogOnFaceApiErrors) { await ErrorTrackingHelper.GenericApiCallExceptionHandler(e, "Vision API failed."); } } finally { this.ComputerVisionAnalysisCompleted?.Invoke(this, EventArgs.Empty); } }
public async Task AnalyzeImageAsync(bool detectCelebrities = false, IEnumerable <VisualFeature> visualFeatures = null) { try { if (visualFeatures == null) { visualFeatures = DefaultVisualFeatures; } if (this.ImageUrl != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.ImageUrl, visualFeatures, detectCelebrities?new string[] { "Celebrities" } : null); } else if (this.GetImageStreamCallback != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.GetImageStreamCallback, visualFeatures, detectCelebrities?new string[] { "Celebrities" } : null); } } catch (Exception e) { this.AnalysisResult = new Microsoft.ProjectOxford.Vision.Contract.AnalysisResult(); if (this.ShowDialogOnFaceApiErrors) { await ErrorTrackingHelper.GenericApiCallExceptionHandler(e, "Vision API failed."); } } finally { this.ComputerVisionAnalysisCompleted?.Invoke(this, EventArgs.Empty); } }
public async Task AnalyzeImageAsync(IList <Details> details = null, IList <VisualFeatureTypes> visualFeatures = null) { try { if (visualFeatures == null) { visualFeatures = DefaultVisualFeatures; } if (this.ImageUrl != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.ImageUrl, visualFeatures, details); } else if (this.GetImageStreamCallback != null) { this.AnalysisResult = await VisionServiceHelper.AnalyzeImageAsync( this.GetImageStreamCallback, visualFeatures, details); } } catch (Exception e) { ErrorTrackingHelper.TrackException(e, "Vision API AnalyzeImageAsync error"); this.AnalysisResult = new ImageAnalysis(); if (this.ShowDialogOnFaceApiErrors) { await ErrorTrackingHelper.GenericApiCallExceptionHandler(e, "Vision API failed."); } } }