React Native
Headless OCR Prediction
The Vision SDK provides camera-independent OCR prediction methods through the VisionCore
module that allow you to process existing images without requiring the camera view. These methods are ideal for workflows where you already have images and need to extract structured data from them.
For complete VisionCore API reference including setEnvironment()
, loadModel()
, and onModelDownloadProgress()
, see the VisionCore Module Documentation.
🔧 Available Prediction Methods
1. On-Device Prediction
VisionCore.predict(imagePath, barcodes)
Performs on-device OCR prediction on an existing image using the configured on-device model.
2. Cloud Prediction Methods
VisionCore.predictShippingLabelCloud(imagePath, barcodes, options)
Processes shipping label images using cloud-based OCR with optional barcode data.
VisionCore.predictItemLabelCloud(imagePath, options)
Processes item label images for SKU, price, and product information extraction.
VisionCore.predictBillOfLadingCloud(imagePath, barcodes, options)
Processes bill of lading documents for carrier and shipment information.
VisionCore.predictDocumentClassificationCloud(imagePath, options)
Classifies and extracts data from various document types.
VisionCore.predictWithCloudTransformations(imagePath, barcodes, options)
Combines on-device processing with cloud-based transformations for enhanced accuracy.
📱 Complete Example
Here's a complete example showing how to implement headless OCR prediction using VisionCore:
📝 Key Benefits
- Camera-Independent: Process existing images without requiring camera access
- Flexible Integration: Integrate OCR into any app workflow
- Fast Processing: On-device models provide quick results
- Cloud Accuracy: Cloud methods offer enhanced accuracy for complex documents
- Metadata Support: Pass custom metadata for enhanced processing context
🔍 Use Cases
- Gallery Processing: Allow users to select images from their photo library
- Batch Processing: Process multiple pre-captured images
- Server Integration: Process images received from servers or APIs
- Offline Analysis: Use on-device prediction when network is unavailable
- Quality Control: Re-process images that failed initial camera capture
Make sure to configure the appropriate ocrMode
and ocrType
props based on your chosen prediction method. On-device methods require the model to be downloaded first using configureOnDeviceModel
.