Mobile Vision APIs let apps analyze images and video for text, faces, objects, and more. Leading vendors include Google (ML Kit on-device and Cloud Vision), Apple (Vision framework, ARKit), Microsoft (Azure Computer Vision), and Amazon (Rekognition), as well as open-source libraries (OpenCV, TensorFlow Lite). Each option has trade-offs: on-device solutions (e.g. ML Kit, Apple Vision) run offline with low latency and high privacy, while cloud APIs (Google, Azure, AWS) can leverage powerful models and scale but incur network latency, cost, and data transfer. Common features across these APIs include text/QR scanning, face detection, image labeling, barcode recognition, and even human pose tracking. We summarize platform support (iOS/Android), performance considerations, pricing, and best practices. The guide includes Kotlin and Swift code for basic OCR and object detection, a provider comparison table, and a decision-flowchart to help choose the right API. Sources are recent official docs and examples from 2023–2026.
Vision API Providers Overview#
Google ML Kit (on-device): A free mobile SDK for Android and iOS that provides on-device ML tasks (OCR, face/object detection, barcode, pose, image labeling) with no cloud dependency. ML Kit can run prebuilt models offline or integrate custom TensorFlow Lite models. It assigns each detected object a bounding box and, for video, a unique ID. ML Kit’s OCR v2 supports major scripts (Latin, Chinese, Japanese, Korean, etc.) and is well-suited for document scanning tasks. Being on-device, it is free to use and respects user privacy (no data leaves the device).
Google Cloud Vision API (cloud): A REST API that analyzes images using Google’s cloud models. It can detect labels/objects, faces, landmarks, logos, text, and moderate content. It supports features like label detection ($1.00–$1.50 per 1000 images) and OCR ($0.60 per 1000) after a 1000-unit free tier. The API processes images in-memory and does not persist them long-term. Google does not use submitted images for training and complies with privacy policies.
Apple Vision Framework (on-device): Built into iOS, Vision offers on-device analysis for live or captured images. It can detect faces (and landmarks/pose), recognize text (OCR), track objects, classify images via Core ML models, detect rectangles (for documents), scan barcodes, and estimate human body pose. For example, VNRecognizeTextRequest extracts printed/handwritten text, and VNDetectHumanBodyPoseRequest tracks body joints. Because it runs on-device, Vision is fast and privacy-preserving.
Microsoft Azure Computer Vision (cloud): Part of Azure AI, this API provides image analysis (tagging, object detection, OCR, face detection, etc.). It includes a Read/OCR service for printed/handwritten text and an Image Analysis service for labels, faces, adult/content moderation, etc.. Pricing is tiered (roughly $1 per 1000 transactions for most features up to 1M transactions). Azure compliance is enterprise-grade (GDPR, encryption), and data is protected under Microsoft’s policies. Results are not stored permanently unless you use specific storage APIs (e.g. for face collections).
AWS Rekognition (cloud): Amazon’s image/video analysis service. Rekognition offers pretrained APIs for:
- Labels/Objects: Recognize objects, scenes, and concepts in images.
- Text (OCR): Detect printed/handwritten text across languages.
- Faces: Detect/analyze faces and compare to collections for identity.
- Moderation: Identify explicit or unsafe content.
- Custom Labels: (ML training) lets you train on your own concepts.
Pricing is pay-per-use: roughly $1 per 1000 images initially (first 1M at $0.0010/image), with a free tier of 1000 images/month for 12 months. By default, Rekognition’s standard operations do not store your images or data, keeping them transient in memory.
Open-Source Alternatives:
- TensorFlow Lite: A mobile ML inference library. With TFLite, you supply or train your own models (object detection (SSD/YOLO), image classification, face detection, pose (MoveNet), etc.). It runs on-device and can leverage NNAPI/GPU for speed. Setup is more involved (packaging models, writing code) but is fully offline and free.
- OpenCV: A C++/Java library for vision on Android/iOS. It includes many image processing algorithms and supports DNN modules for object detection/classification using pretrained models. OpenCV gives full control but requires more code and does not include high-level turnkey detectors out-of-the-box (you often integrate or train models yourself).
Platform Support#
- Android: ML Kit (Android SDK), Google Cloud (REST), AWS/Azure (REST), OpenCV (Java). Popular cross-platform frameworks (Flutter, React Native) have plugins/wrappers for ML Kit or cloud Vision APIs.
- iOS: Apple Vision (native Swift/ObjC APIs), ML Kit (iOS CocoaPods), Google Cloud/Azure/AWS (network APIs via Swift/ObjC), TFLite/OpenCV (CocoaPods/SwiftPM).
- Cross-platform: ML Kit (via Firebase or standalone), custom models with TFLite, or calling cloud APIs (HTTP) from any platform. Choice depends on app needs: for example, Flutter developers often use the Google ML Kit plugin or call cloud endpoints.
On-Device vs Cloud: Trade-offs#
Latency: On-device inference is much faster for real-time use. Modern phones run 1–3 B-parameter models in ~80–300 ms. Cloud calls incur network round-trip (often 400–1,200 ms), which can stall an interactive UI. For user-facing features (camera scanning, AR), the speed advantage of on-device is significant.
Accuracy/Capability: Cloud APIs can host very large, updated models (leveraging server GPUs) and often yield higher accuracy or advanced features (e.g. celebrity recognition, custom AutoML). On-device models are limited by device memory and compute (flagship chips handle ~7B parameters), so very large models or ensembles must run in the cloud. Custom cloud models (e.g. AWS Custom Labels, Google AutoML Vision) are easier to scale up.
Privacy: On-device keeps all data local. No image pixels leave the user’s device, which is crucial for sensitive data (health records, personal photos). Cloud APIs require sending images/data to servers; while providers pledge not to misuse or store images, this still entails trust and encryption (e.g. Google Vision operates under strict data processing addenda, and Rekognition non-storage APIs do not persist images). In regulated apps (healthcare, finance), on-device is safer.
Cost: Cloud usage costs accrue per request. E.g. Google Cloud Vision charges ~$1.00–$1.50 per 1000 label-detection calls, and AWS Rekognition about $1 per 1000 images initially. Enterprise cloud billing can reach tens of thousands annually. On-device inference (ML Kit, Vision, TFLite) is free at runtime (aside from initial development effort). Long-term, high-volume apps save money by avoiding per-call fees.
Connectivity: Only cloud APIs need internet. On-device works offline, which is vital in remote areas or for continuous use (e.g. field workers). For hybrid approaches, apps can perform quick local inference and optionally send data to cloud for deeper analysis later.
Common Vision Features#
Modern vision SDKs provide a core set of capabilities:
- Face Detection & Analysis: Locate faces and (often) landmarks (eyes, nose) and attributes (smile, eyes open, estimated age/gender). Apple’s Vision provides face rectangles and detailed landmarks. ML Kit and Rekognition detect faces and can compare or analyze attributes.
- Optical Character Recognition (OCR): Extract text from images (printed, handwritten). ML Kit’s Text Recognition works on-device; Google Cloud and AWS offer OCR services for many languages (handwritten support). Apple Vision’s
VNRecognizeTextRequesthandles multi-language OCR on-device. Common uses: scanning receipts, documents, IDs. - Object Detection/Labeling: Identify generic objects or scenes (e.g. “car”, “dog”, “beach”) in an image. Google Cloud’s Label Detection, Azure’s tagging, and AWS DetectLabels all do this. On-device, ML Kit can detect and even track up to five objects per image. For custom objects (e.g. specific products), one may use AutoML/Custom Labels or train a TensorFlow Lite model.
- Image Classification: Assign a single category to a whole image (e.g. breeds, product types). Achieved via Core ML models on iOS or by sending to a cloud classifier. ML Kit’s base Image Labeling model recognizes ~4000 common concepts on-device.
- Pose Estimation: Detect human body keypoints (joints, limbs). Apple Vision has a human pose request (since iOS 14) that finds joints. ML Kit’s Pose Detection API does similar on Android/iOS. Useful for fitness apps or AR.
- Barcode/QR Scanning: Recognize barcodes or QR codes. ML Kit and many frameworks have built-in barcode scanners. Apple’s
VNDetectBarcodesRequestfinds many formats on-device. These typically run very fast and are used in commerce or authentication. - Other: Some APIs offer image segmentation (separate foreground), document scanning (rectangle detection and perspective correction), explicit content moderation, and even facial liveness. For example, VisionKit provides a full document scanner UI on iOS.
Each provider may not offer all features. For example, Apple Vision lacks a built-in general object detector (it focuses on faces, text, rectangles, poses), whereas Google/Azure/AWS provide broad tagging but require cloud calls. ML Kit and TFLite fill many gaps with on-device models (e.g. ML Kit now has image labeling and object detection on-device).
SDKs and Sample Code#
Android (Kotlin): Using ML Kit for OCR or object detection:
Text (OCR):
val image = InputImage.fromBitmap(bitmap, 0) val recognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS) recognizer.process(image) .addOnSuccessListener { visionText -> for (block in visionText.textBlocks) { Log.d("OCR", block.text) } } .addOnFailureListener { e -> Log.e("OCR", "Failed", e) }This uses
com.google.mlkit:text-recognitionto run OCR on-device and prints detected text.Object Detection:
val options = ObjectDetectorOptions.Builder() .setDetectorMode(ObjectDetectorOptions.SINGLE_IMAGE_MODE) .enableMultipleObjects() .enableClassification() // optional: label classification .build() val objectDetector = ObjectDetection.getClient(options) objectDetector.process(image) .addOnSuccessListener { detectedObjects -> for (obj in detectedObjects) { val box = obj.boundingBox // Rectangle in image val labels = obj.labels.map { it.text } Log.d("Object", "Detected $labels at $box") } } .addOnFailureListener { e -> Log.e("Object", "Failed", e) }This finds up to 5 objects in
bitmapwith labels. (ML Kit setup requires adding the appropriate Gradle dependency and Google Play services.)
iOS (Swift): Using Vision framework for OCR and object recognition:
Text (OCR):
func recognizeText(from uiImage: UIImage) { guard let cgImage = uiImage.cgImage else { return } let request = VNRecognizeTextRequest { request, error in guard let results = request.results as? [VNRecognizedTextObservation] else { return } for obs in results { if let candidate = obs.topCandidates(1).first { print("OCR text: \(candidate.string)") } } } request.recognitionLevel = .accurate let handler = VNImageRequestHandler(cgImage: cgImage, options: [:]) try? handler.perform([request]) }This Swift function uses
VNRecognizeTextRequestto extract text and prints it.Object Classification: (Vision requires a Core ML model; here using a built-in model
MobileNetV2from Core ML.)func classifyImage(_ uiImage: UIImage) { guard let model = try? VNCoreMLModel(for: MobileNetV2().model), let cgImage = uiImage.cgImage else { return } let request = VNCoreMLRequest(model: model) { request, error in guard let results = request.results as? [VNClassificationObservation], let top = results.first else { return } print("Object: \(top.identifier) (confidence \(top.confidence))") } let handler = VNImageRequestHandler(cgImage: cgImage, options: [:]) try? handler.perform([request]) }This uses Vision + Core ML to classify the image’s main object. For true object detection (bounding boxes), one would use a model like YOLO or SSD with
VNCoreMLRequest.
These snippets assume necessary imports (com.google.mlkit.* on Android, import Vision, import CoreML on iOS) and that camera/image capture is handled elsewhere. For full samples, see the Google ML Kit Quickstart and Apple’s Vision sample code.
Performance Considerations and Benchmarking#
Measuring vision API performance is critical. Latency can be tested by capturing processing time per image: on-device models often run in 10–200ms range (depending on device and model size). Cloud calls should be measured end-to-end, including network time (which varies by connection). Tools like Android Profiler or iOS Instruments can profile CPU/GPU usage and memory during inference.
Key factors: model size, input image size, and hardware acceleration. For on-device ML (ML Kit, TFLite), ensure you use hardware acceleration (NNAPI on Android, Core ML GPU/Neural Engine on iOS) when possible for faster inference. Benchmark on target devices (especially low-end) with realistic images. For cloud, consider batching requests versus real-time streaming. Document CPU/GPU load and battery use as high-res video/image analysis can strain resources.
A typical benchmarking approach:
- Controlled tests: Run each API/model on a fixed set of images and measure average inference time.
- Real usage: Time the API in-app with real camera frames under different network conditions.
- Accuracy vs speed: Compare fast vs accurate modes (some SDKs offer performance modes, e.g. ML Kit’s “fast” vs “accurate” settings for face detection).
Pricing Models#
Google ML Kit / Apple Vision / Open-Source: Free to use (no API calls or licenses needed). ML Kit integration is provided by Google at no cost. Apple’s Vision is part of iOS. TFLite/OpenCV are open-source. Cost comes only from development time and any optional cloud usage.
Google Cloud Vision: Pay-as-you-go. After 1000 free monthly units, features cost ~$0.60–$1.50 per 1000 images depending on feature (e.g. label detection ~$1.00, OCR ~$0.60 per 1000). Pricing is tiered and usage-based.
AWS Rekognition: Tiered pricing. The first 12 months have a free tier (1000 images/month for most APIs). Thereafter, DetectLabels and similar “Group 2” calls are ~$0.0010 per image for the first 1 M (i.e. $1 per 1000), dropping to $0.0008 for the next 1.5M. Face-related storage has separate fees if you index faces into collections. No upfront commitment, but fees can add up for high-volume apps.
Microsoft Azure Computer Vision: After a free tier (5000 transactions/month), pay-per-transaction. Roughly $1.00 per 1000 transactions for standard vision tasks on the first 1M transactions (e.g. OCR, object detection). Pricing falls with higher volume (e.g. $0.65 per 1000 for 1–10M). Custom Vision (for training your own models) charges per training hour and per 1000 predictions.
When choosing, consider not only per-call fees but also any required compute/storage (e.g. face collection storage on AWS). Also account for development overhead: using on-device models may have zero runtime cost but might require more engineering (training custom models, handling device compatibility).
Privacy and Security Best Practices#
- Minimize cloud usage: Whenever possible, use on-device inference so no image data is sent off the device. This avoids compliance issues (GDPR, HIPAA, etc.).
- Explicit consent: If sending images to a server, obtain user permission and clearly state what data is collected and why. Do not send personally identifying images (faces) unless necessary.
- Encryption: Always use HTTPS/TLS for API calls. Some providers support customer-managed keys (e.g. Google Cloud Vision with CMEK) to ensure only you can decrypt data.
- Data minimization: Strip metadata (EXIF, geotags) from images before sending to cloud APIs to avoid leaking location or device info. If possible, crop the image to only the region of interest on-device.
- Handle results securely: For sensitive outputs (like extracted text or face IDs), store them securely (encrypted at rest) and limit their scope. Regularly audit who has access to vision data.
- Follow provider policies: Google Vision, Azure, and AWS outline their data handling: Google doesn’t use your images for training and deletes them after processing; AWS Rekognition’s non-storage operations do not persist images. Understand these terms. If using cloud services, consider disabling any logging or storage, and comply with any data residency requirements (choose data center regions accordingly).
- On-device safeguards: Even on-device APIs need caution: e.g. don’t store sensitive images longer than needed, and clear caches after processing if using intermediate storage.
UX Guidelines#
When integrating vision features in an app, clear UX improves usability and performance perception:
- Camera Overlay: Show guides or borders indicating the target area (e.g. document scanning frame, barcode overlay) to help users position the camera correctly.
- Real-time Feedback: Display bounding boxes, labels, or highlights around detected items as they are recognized. For example, draw rectangles around detected faces or recognized text to confirm detection. This reassures users that the app is actively “looking”.
- Loading Indicators: For cloud processing, show a spinner or progress message so the user knows the app is working (e.g. “Analyzing image…” during network call). Avoid long freezes.
- Error Handling: If detection fails (no text found, no barcode), provide clear messages or alternatives (e.g. “Hold steady or take a new photo”).
- Performance Modes: Let users toggle modes if available (e.g. “High accuracy” vs “Fast” in ML Kit face detection) if it affects speed/battery.
- Permission Rationale: Prompt for camera permission with a brief explanation of why (e.g. “This app needs camera access to scan documents”).
- Manual Entry: Always offer a manual alternative (typing text) if OCR fails, for better accessibility.
- Result Confirmation: After scanning, allow users to correct or confirm the recognized result (especially with OCR, where recognition might err).
Refer to platform HIG or Material guidelines for camera usage. For instance, Apple’s VisionKit/AVFoundation guidelines recommend explaining “scan” vs “capture” terms and ensuring the UI remains understandable even if ML fails.
Deployment and Testing Tips#
- Test on real devices: Emulators may not simulate camera/ML performance accurately. Test on a range of devices (low-end, high-end, different OS versions).
- Vary lighting and content: Check accuracy in bright/dark lighting, different angles, and with real-world image variations (fonts, backgrounds). For text, test with different scripts if multi-language.
- Handle Orientation: Camera images may come in rotated. Ensure you pass the correct rotation to APIs (ML Kit’s
InputImage.fromMediaImage(mediaImage, rotation)or Vision’scgImagehandler). Incorrect orientation is a common bug that leads to no detection. - Resource Management: On Android, use the CameraX or Camera2 API properly and close sessions when not in use. Cancel pending ML Kit tasks if new frames come in to avoid piling up requests.
- Performance Profiling: Use Android Profiler or Xcode Instruments to find bottlenecks. If inference is slow, consider downsizing input images (e.g. reduce resolution) or running on a background thread.
- API Limits: Cloud services often have rate limits. Implement retry/backoff on 429 responses. Batch images where supported.
- Unit/Integration Tests: For core logic (e.g. post-processing of labels), write unit tests. For full vision flows, consider instrumented tests using known images (e.g. include test images in your test bundle and assert expected labels appear).
- Continuous Learning: Monitor real usage. If certain objects/text fail often, consider augmenting on-device models (custom TFLite) or fallback to cloud for those cases.
Troubleshooting Checklist#
When things go wrong, check these common issues:
- Missing permissions: Confirm camera permission is granted before starting the detector. On Android, both Camera and Internet (for cloud) permissions; on iOS, the NSCameraUsageDescription key.
- No detection: Ensure the image quality is good (clear, well-lit). For cloud, verify the image meets size/format limits. Ensure you’re using the correct request (e.g. Tesseract vs Latin OCR). Check if the API requires an explicit language hint.
- Orientation issues: Verify that the image rotation is correctly handled. E.g. face/text scanning often fails if the image is sideways.
- API Initialization: On Android, check you’ve initialized ML Kit correctly (dependencies added, client configured). On iOS, ensure the Vision request is created on a supported version (some requests need iOS 13+).
- Mixed results: If detection is inconsistent, try switching model options (ML Kit face detection has “FAST” vs “ACCURATE” modes). For object detection, ensure you enabled classifications if you need labels.
- Memory/Performance crashes: On-device models can be memory-intensive. Catch out-of-memory errors. If using custom TFLite models, optimize them (quantize or reduce size).
- Cloud API errors: Check API keys or credentials. Ensure the API endpoint and region are correct. If a request fails, examine the error code (authentication vs unsupported content).
- Unexpected output: Different providers may use different label vocabularies. For example, Google’s Vision might return “automobile” vs AWS “car”. If you rely on specific labels, normalize or use custom models.
- Rate limits: If requests suddenly fail, check provider quotas and throttle usage.
- Dependencies and versions: In Android, ensure you use compatible ML Kit versions (AndroidX) and the correct Kotlin/Java bindings. On iOS, check that the Vision API is available on your deployment target.
Keeping a log of issues during development and tracking incoming errors (with analytics) can help identify platform-specific bugs.
Provider Comparison#
| Provider / SDK | Deployment | Key Features | Platforms | Pricing (per 1K calls) |
|---|---|---|---|---|
| Google ML Kit | On-device (free) | Text, faces, objects, barcodes, pose, segmentation | Android, iOS | Free (no per-call fee) |
| Apple Vision | On-device (free) | Faces, landmarks, OCR, barcode, poses, rectangles | iOS/macOS (Vision only) | Free (part of OS) |
| Google Cloud Vision | Cloud (paid) | Label detection, OCR, face, logo, landmark, safe search | Any (REST API) | ~$0.60–1.50 per 1K (after 1K free) |
| AWS Rekognition | Cloud (paid) | Label detection, OCR, face analysis, moderation, celebrity | Any (SDK/REST) | ~$1.0 per 1K (first 1M images) |
| Azure Computer Vision | Cloud (paid) | Tags, OCR, face, read, describe, object detection | Any (REST) | ~$1 per 1K (first 1M) |
| TensorFlow Lite | On-device (free) | Custom models: classification, detection, pose, etc. | Android, iOS, others | Free (open-source) |
| OpenCV | On-device (free) | General vision functions; DNN module for custom models | Android, iOS, others | Free (open-source) |
All cloud APIs have free-tier limits and volume discounts; exact pricing should be checked on the provider’s site. On-device SDKs (ML Kit, Apple Vision) come with OS/platform updates and have no usage fees.
Further Reading#
- Official Docs: Google ML Kit Guides, Google Cloud Vision Docs, Apple Vision Documentation, Azure Cognitive Services docs, AWS Rekognition Developer Guide. These provide up-to-date API references and quickstarts.
- Sample Projects: Google’s ML Kit Quickstart (GitHub) for Android, Apple’s Vision sample code, TensorFlow Lite example apps on GitHub.
- Tutorials: Medium blogs and YouTube (e.g. building OCR apps on iOS/Android), and posts on combining Core ML with Vision.
- Benchmarks: For deeper performance tuning, see Roboflow’s analysis on edge vs cloud inference and MLPerf for ML on mobile.
By weighing the trade-offs above, you can choose an API or mix of APIs that best fits your mobile app’s needs in terms of latency, cost, accuracy, and user privacy.
Sources: Authoritative docs and recent resources have been cited throughout (e.g. Google Developers ML Kit, Apple WWDC/visions blogs, Microsoft Learn, AWS Dev Guide, and industry analysis).

