Пример #1
0
        void Vidado__READ_RecognitionPostProcessing(object sender, PostRecognitionEventArgs e)
        {
            //Get VIDADO READ API token from https://api.vidado.ai/portal
            var apiToken = "";
            var api      = "https://api.vidado.ai/read/text";


            var imageData = File.ReadAllBytes(e.ImangeFile);

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Add("Authorization", apiToken);
                using (var content = new MultipartFormDataContent())
                {
                    content.Add(new StreamContent(new MemoryStream(imageData)), "image", "image.tiff");

                    var result = client.PostAsync(new Uri(api), content).Result;

                    try
                    {
                        result.EnsureSuccessStatusCode();
                        //var responseData = result.Content.ReadAsStringAsync();
                        Task <string> responseData          = result.Content.ReadAsStringAsync();
                        var           res                   = responseData.Result;
                        var           digitization_response = JsonSerializer.Deserialize <Vidado__Response>(res);
                        e.value      = digitization_response.value;
                        e.confidence = Convert.ToInt32(digitization_response.confidence * 100);
                    }
                    catch (HttpRequestException)
                    {
                        throw;
                    }
                }
            }
        }
Пример #2
0
 void Save_Snippet_RecognitionPostProcessing(object sender, PostRecognitionEventArgs e)
 {
     File.Copy(e.ImageFile, @"C:\temp\test.tiff");
 }