Let's be clear: when standard OCR solutions fail on unusual fonts or poor lighting — especially when extracting data from hundreds of invoices or passports — Azure Computer Vision from Microsoft comes to the rescue. Our certified engineers configure the Read API and Document Intelligence for your specific tasks, delivering accuracy up to 99%. We've implemented over 30 document automation projects across industries. Automation reduces manual processing costs by up to 80%, saving approximately $15,000 per month on 10,000 documents. Typical integration costs range from $3,000 to $10,000, depending on complexity.
Why Read API Is the Primary OCR Service in Azure?
Azure Computer Vision offers two OCR services: Read API (optimized for dense documents, recommended by Microsoft) and the legacy OCR API (only for simple images). Read API 4.0 works both in the cloud and as an on-premise container. We use the text recognition API because it handles handwritten text, tables, and multi-page PDFs. According to official Microsoft documentation, Read API's accuracy on structured documents reaches 99%. Compared to legacy OCR, the Azure OCR service provides 2x higher accuracy on handwritten content.
Integrating the OCR API in Python: Step-by-Step Guide
- Create a Computer Vision resource in Azure portal (key and endpoint).
-
Install the library
azure-cognitiveservices-vision-computervisionvia pip. - Write an async call — the code below shows class
AzureOCRfor extracting text from an image. - Process the result — parse bounding boxes for tables, filter by confidence.
- Add retry logic for timeouts (exponential backoff).
from azure.cognitiveservices.vision.computervision import ComputerVisionClient
from azure.cognitiveservices.vision.computervision.models import OperationStatusCodes
from msrest.authentication import CognitiveServicesCredentials
import time
class AzureOCR:
def __init__(self, endpoint: str, api_key: str):
self.client = ComputerVisionClient(
endpoint,
CognitiveServicesCredentials(api_key)
)
def extract_text_from_url(self, image_url: str) -> str:
"""Read API: async processing via URL"""
read_response = self.client.read_in_stream(
open('image.jpg', 'rb'),
raw=True
)
# Get operation ID from header
operation_location = read_response.headers['Operation-Location']
operation_id = operation_location.split('/')[-1]
# Wait for result
while True:
read_result = self.client.get_read_result(operation_id)
if read_result.status not in [
OperationStatusCodes.running,
OperationStatusCodes.not_started
]:
break
time.sleep(0.5)
# Extract text
text_lines = []
if read_result.status == OperationStatusCodes.succeeded:
for page in read_result.analyze_result.read_results:
for line in page.lines:
text_lines.append(line.text)
return '\n'.join(text_lines)
def extract_with_positions(self, image_path: str) -> list[dict]:
"""Extraction with bounding box coordinates"""
with open(image_path, 'rb') as f:
read_response = self.client.read_in_stream(f, raw=True)
operation_id = read_response.headers['Operation-Location'].split('/')[-1]
while True:
result = self.client.get_read_result(operation_id)
if result.status not in [OperationStatusCodes.running,
OperationStatusCodes.not_started]:
break
time.sleep(0.3)
words = []
if result.status == OperationStatusCodes.succeeded:
for page in result.analyze_result.read_results:
for line in page.lines:
for word in line.words:
words.append({
'text': word.text,
'confidence': word.confidence,
'bbox': word.bounding_box
})
return words
Contact us to develop a similar solution for your project.
When to Use Document Intelligence Instead of Read API?
For arbitrary text on images, use the OCR API. If you need to extract structured fields from invoices, contracts, or IDs, Document Intelligence (formerly Form Recognizer) is better. It offers prebuilt models and allows custom ones. Document Intelligence is up to 3x more accurate on structured documents compared to general OCR. Example invoice analysis:
from azure.ai.formrecognizer import DocumentAnalysisClient
from azure.core.credentials import AzureKeyCredential
class AzureDocumentIntelligence:
def __init__(self, endpoint: str, api_key: str):
self.client = DocumentAnalysisClient(
endpoint=endpoint,
credential=AzureKeyCredential(api_key)
)
def analyze_invoice(self, image_path: str) -> dict:
"""Specialized invoice analysis"""
with open(image_path, 'rb') as f:
poller = self.client.begin_analyze_document(
'prebuilt-invoice', f
)
result = poller.result()
invoices = []
for invoice in result.documents:
fields = invoice.fields
invoices.append({
'vendor_name': fields.get('VendorName', {}).get('value'),
'invoice_date': str(fields.get('InvoiceDate', {}).get('value')),
'total_amount': fields.get('AmountDue', {}).get('value'),
'invoice_id': fields.get('InvoiceId', {}).get('value'),
'line_items': [
{
'description': item.get('Description', {}).get('value'),
'amount': item.get('Amount', {}).get('value')
}
for item in (fields.get('Items', {}).get('value') or [])
]
})
return invoices[0] if invoices else {}
How to Deploy OCR On-Premise?
For data requiring local processing, use the Read API Container. Data stays within your infrastructure with minimal latency. This container is essential in banking and government sectors. Launch is simple:
docker run --rm -it -p 5000:5000 \
-e ApiKey=YOUR_KEY \
-e Billing=YOUR_ENDPOINT \
mcr.microsoft.com/azure-cognitive-services/vision/read:3.2
Case: Processing 10,000 Invoices per Day
For a large retailer, we deployed a hybrid solution: cloud Read API for quick requests and on-premise container for sensitive data. We set up parallel queues with Azure Service Bus, enabling processing of up to 10,000 invoices daily with p99 latency < 2s. Field recognition accuracy reached 98.5%.Azure Computer Vision OCR Implementation Process
- Audit — analyze current document processing workflows, document types, volumes.
- Design — select service (Read API / Document Intelligence), architecture (cloud / container / hybrid).
- Integration — develop a Python library for API calls with error handling, retries, monitoring.
- Testing — verify accuracy on your samples, stress test under load.
- Deploy — deploy to production, set up CI/CD, monitor latency and accuracy.
- Support — train your team, provide documentation, post-launch support.
What's Included in the Work (Deliverables)
- Documentation — architecture description, operation manual, API description.
- Source code — Python module for Azure Computer Vision integration, including error handling and retries.
- Team training — workshop on using the developed solution.
- Support — warranty maintenance for one month after launch.
Common OCR Integration Mistakes to Avoid
- Wrong API selection: using legacy OCR instead of Read API. Always use the modern text recognition service.
- Ignoring limits: Read API is restricted to 10 requests per minute per resource. Distribute requests across multiple keys or introduce a queue.
- Missing error handling: timeouts, service unavailability. Add exponential backoff and retry logic.
- Forgetting bounding boxes: for table text extraction, coordinates are mandatory. Always use
extract_with_positionswhen working with tables.
| Feature | Read API | Document Intelligence |
|---|---|---|
| OCR for arbitrary text | Yes | Yes |
| Table structure | No | Yes |
| Specialized models (invoice, ID) | No | Yes |
| Custom models | No | Yes |
| Price per 1000 pages | $1.50 | $10–50 |
| Task | Timeline |
|---|---|
| Basic Read API integration | 3–5 days |
| Document Intelligence with field extraction | 1–2 weeks |
| On-premise container + PDF processing | 1–2 weeks |
Checklist for Successful Integration
- Determine document types and required fields.
- Choose the appropriate service tier (S0/S1) based on volumes.
- Implement async calls with error handling.
- Set up monitoring of metrics (latency, accuracy, error rate).
- Conduct A/B testing on real data.
Our team, with over 30 successful projects and 5+ years of experience, delivers reliable OCR solutions. Our Azure Computer Vision OCR integration ensures high accuracy and efficiency. Get a consultation from an Azure Computer Vision engineer. Contact us to assess your project — we'll help automate document processing with up to 99% accuracy.







