Read and Extract Text from Images using Azure READ API - Exam AI-102

Read and Extract Text from Images using Azure READ API

Question

You plan to use READ API in Azure in order to read printed and handwritten text from a given set of images accessible through a url.

You have installed the client libraries and authenticated the computer vision client.You use the ReadAsync method to get the operation id.

You then query the service to get read results.

Given the scenario, review the code below and complete it choosing the most appropriate option

ReadOperationResult results; Console.WriteLine(""Read File From the Url"); Console.WriteLine(); do { results = await client…………………………………(Guid.Parse(operationId)); } 

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: C.

Option A is incorrect because AnalyzeImageByDomainInStream and AnalyzeImageByDomainInStream methods are used to recognize content within an image by applying a domain-specific model.

They are generally used for analyzing celebrities and landmarks.

Option B is incorrect because AnalyzeImageByDomainInStream and AnalyzeImageByDomainInStream methods are used to recognize content within an image by applying a domain-specific model.

They are generally used for analyzing celebrities and landmarks.

Option C is correct because the GetReadResultAsync method is used to get OCR results of the Read operation.

Here is the completed C# code:

<pre class="brush:java;">ReadOperationResult results;

Console.WriteLine(""Read File From the Url");

Console.WriteLine();

do.

{

results = await client.GetReadResultAsync(Guid.Parse(operationId));

}

</pre>

Option D is incorrect because the ReadAsync method is called to perform a Read operation.

It is an asynchronous call.

This call returns a header with Operation-Location.

The header contains the URL with Operation Id that is utilized by the Get Read Result Async method to fetch read results from the images.

Reference:

To learn more about read client in OCR, use the link given below:

Based on the scenario, the appropriate method to be used to retrieve the read results is the "GetReadResultAsync" method. This method is used to retrieve the results of a Read operation that was previously initiated using the "ReadAsync" method.

The code should be completed as follows:

javascript
ReadOperationResult results; Console.WriteLine("Read File From the Url"); Console.WriteLine(); do { results = await client.GetReadResultAsync(Guid.Parse(operationId)); } while (results.Status == OperationStatusCodes.Running);

The code above initializes a new instance of the ReadOperationResult object, which will hold the results of the Read operation. The code then starts a do-while loop to retrieve the results of the operation using the "GetReadResultAsync" method.

The loop will continue to execute until the operation is complete. The status of the operation can be checked using the "OperationStatusCodes" enumeration. Once the operation is complete, the results will be stored in the "results" object, and can be processed as needed.

Option A "AnalyzeImageByDomainInStream" and Option B "AnalyzeImageByDomainInStreamAsync" are not appropriate because these methods are used to analyze an image using pre-built models in Azure Cognitive Services, and not for the purpose of reading text from an image.

Option D "ReadAsync" is appropriate for initiating the Read operation, but it is not used for retrieving the results of the operation. The "ReadAsync" method returns an operation ID, which is then used with the "GetReadResultAsync" method to retrieve the results.