Closed EcoleKeine closed 1 year ago
find the problem: The latest release version of Azure.AI.FormRecognizer is 4.0.0, result class DocumentPage no contain barcodes. this should be documented.
But change to version 4.1.0-beta.1, I get 404 error.
@EcoleKeine
I've delegated this to @laujan , a content author, to review and share their valuable insights.
Hi @EcoleKeine, Thank you for your feedback. The barcode extraction feature is available in the latest REST API and SDK versions:
We've updated the documentation.
It looks as if you were using C#. Here is a code snippet that is supported by the latest version:
using Azure;
using Azure.AI.FormRecognizer.DocumentAnalysis;
string endpoint = "your-endpoint";
string key = "your-api-key";
AzureKeyCredential credential = new AzureKeyCredential(key);
DocumentAnalysisClient client = new DocumentAnalysisClient(new Uri(endpoint), credential);
Uri barcodeUri = new Uri("https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/barcodes.png");
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-read", barcodeUri);
AnalyzeResult result = operation.Value;
foreach(DocumentPage page in result.Pages) {
for (int i = 0; i < page.Barcodes.Count; i++) {
DocumentBarcode barcode = page.Barcodes[i];
Console.WriteLine($"Document barcodes {i} is Kind: {barcode.Kind},Value: {barcode.Value}, Confidence: {barcode.Confidence} ");
}
}
For more information on barcodes, see DocumentPage.Barcodes Property
Thanks again!
I tried to extract barcode information from a code 39 barcode image using the Form Recognizer, but no barcode information was returned.
image is https://learn.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/media/barcodes/code-39.png?view=form-recog-3.0.0 without bottom characters
model is prebuilt-read/prebuilt-layout free plan F0
there are no barcodes collection in return:
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.