Exemple #1
0
        public async Task <string> Run(string base64EncodedImage)
        {
            var VisionClient = new Microsoft.ProjectOxford.Vision.VisionServiceClient(
                //FIXME Private Information
                //==================================================
                "9ae131be7a4b43d68a08bccb1375bf8b"
                //==================================================
                );
            var response = await VisionClient.DescribeAsync(new MemoryStream(Convert.FromBase64String(base64EncodedImage)));

            return(response.Description.Captions.First()?.Text);
        }
Exemple #2
0
        private async Task <LiveCameraResult> DescriptionAnalysisFunction(VideoFrame frame)
        {
            // Encode image.
            var jpg = frame.Image.ToMemoryStream(".jpg", s_jpegParams);
            // Submit image to API
            var result = await _visionClient.DescribeAsync(jpg);

            // Count the API call.
            Properties.Settings.Default.VisionAPICallCount++;
            // Output.
            LiveCameraResult cResult = new LiveCameraResult();

            cResult.Caption = result.Description.Captions;

            return(new LiveCameraResult {
                Caption = result.Description.Captions
            });
        }