Exemplo n.º 1
0
        public async Task StartRecognizeIdentityDocumentsIncludeFieldElements()
        {
            var client  = CreateFormRecognizerClient();
            var options = new RecognizeIdentityDocumentsOptions()
            {
                IncludeFieldElements = true
            };
            RecognizeIdentityDocumentsOperation operation;

            using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.DriverLicenseJpg);
            using (Recording.DisableRequestBodyRecording())
            {
                operation = await client.StartRecognizeIdentityDocumentsAsync(stream, options);
            }

            RecognizedFormCollection recognizedForms = await operation.WaitForCompletionAsync();

            var form = recognizedForms.Single();

            ValidatePrebuiltForm(
                form,
                includeFieldElements: true,
                expectedFirstPageNumber: 1,
                expectedLastPageNumber: 1);
        }
Exemplo n.º 2
0
        public async Task ScanLocalCardId(string filePath)
        {
            using var stream = new FileStream(filePath, FileMode.Open);
            var options = new RecognizeIdentityDocumentsOptions()
            {
                ContentType = FormContentType.Jpeg
            };

            RecognizeIdentityDocumentsOperation operation = await _client.StartRecognizeIdentityDocumentsAsync(stream, options);

            Response <RecognizedFormCollection> operationResponse = await operation.WaitForCompletionAsync();

            RecognizedFormCollection identityDocuments = operationResponse.Value;
            RecognizedForm           identityDocument  = identityDocuments.Single();
        }