CameraX & ML Kit Vision Integration 📸
Efficient real-time image analysis.
⚡ When to Use
- When asked to build barcode scanners, text recognition, or live face detection.
🏗️ Core Rules / Pillars
1. ImageAnalysis UseCase
- Pattern: ALWAYS use CameraX's
ImageAnalysisuse case bound to the lifecycle. - Implementation: Pipe the
ImageProxydirectly to anInputImagefor ML Kit, ensuring you callimageProxy.close()inside the.addOnCompleteListener.
🚧 Critical Anti-Hallucination Guards
- Trap: NEVER hold references to
ImageProxyoutside the analyzer scope to avoid out-of-memory errors!