I want to be able to scan and the app automatically recognize what the card is and which set it is from. #3

Open
opened 2026-06-23 20:26:05 +00:00 by elvis · 1 comment
Owner
No description provided.
elvis added this to the pokedex project 2026-06-23 20:36:55 +00:00
Author
Owner

Plan: Card and Set Recognition via Camera Scanning

To add camera scanning capabilities that recognize card details and sets:

1. **Dependencies and Permissions:**
   * Request `android.permission.CAMERA` in `AndroidManifest.xml` and implement a runtime permission check in-app.
   * Add Jetpack CameraX dependencies (`camera-camera2`, `camera-lifecycle`, `camera-view`) and Google ML Kit Text Recognition (`play-services-mlkit-text-

recognition) to libs.versions.tomlandbuild.gradle.kts`.

2. **Scanner UI (`ScanScreen.kt`):**
   * Implement a scanner screen using CameraX’s `PreviewView` embedded inside a Compose `AndroidView`.
   * Add a visual card alignment guide frame overlay.

3. **ML Kit Text Analyzer:**
   * Set up an `ImageAnalysis.Analyzer` to process camera frames.
   * Convert `ImageProxy` to `InputImage` and run ML Kit’s `TextRecognizer` on it.
   * Process the recognized text:
     * Search for standard card number formats (e.g., matching the regex `\b\d+/\d+\b` which matches patterns like "042/185").
     * Search for capitalized text blocks at the top of the card representing candidate card names.

4. **Card Resolution and Confirmation:**
   * Query the pokemontcg.io API using the detected name and card number (e.g., query `name:"DetectedName" number:DetectedNumber`).
   * Display a bottom sheet preview of the matched card with options to add it to a binder or open details.
   * Upon confirmation, navigate to `CardDetailScreen` and populate the active card session.
### Plan: Card and Set Recognition via Camera Scanning To add camera scanning capabilities that recognize card details and sets: 1. **Dependencies and Permissions:** * Request `android.permission.CAMERA` in `AndroidManifest.xml` and implement a runtime permission check in-app. * Add Jetpack CameraX dependencies (`camera-camera2`, `camera-lifecycle`, `camera-view`) and Google ML Kit Text Recognition (`play-services-mlkit-text- recognition`) to `libs.versions.toml` and `build.gradle.kts`. 2. **Scanner UI (`ScanScreen.kt`):** * Implement a scanner screen using CameraX’s `PreviewView` embedded inside a Compose `AndroidView`. * Add a visual card alignment guide frame overlay. 3. **ML Kit Text Analyzer:** * Set up an `ImageAnalysis.Analyzer` to process camera frames. * Convert `ImageProxy` to `InputImage` and run ML Kit’s `TextRecognizer` on it. * Process the recognized text: * Search for standard card number formats (e.g., matching the regex `\b\d+/\d+\b` which matches patterns like "042/185"). * Search for capitalized text blocks at the top of the card representing candidate card names. 4. **Card Resolution and Confirmation:** * Query the pokemontcg.io API using the detected name and card number (e.g., query `name:"DetectedName" number:DetectedNumber`). * Display a bottom sheet preview of the matched card with options to add it to a binder or open details. * Upon confirmation, navigate to `CardDetailScreen` and populate the active card session.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
elvis/pokebox#3
No description provided.