Lineage OS Glimpse OCR & QRCode (?) Proposal

Inspired by Apple OCR for photos.

Goals

Requirements

  1. Perform OCR accurately and quickly
  2. Provide Points & Bounding boxes
  3. Enable users to “hold click” to select text

Guidelines

  1. Not too many new dependencies
  2. Should not impact build process
  3. Careful with large dependencies
  4. No Google Services

UX

User double taps an image to possibly select text. If a model is not present, the user is prompted to install a model. If a model is present, OCR is performed on the image. If OCR is successful, the view enters “ocr select mode”, darkening out the image. Text sequence near where the user double tapped is highlighted. User can drag their finger across the screen to select more text. User can than press either the close button to exit select mode, or press the check mark button to confirm their selection which than copies the text to their keyboard.

UI

Libraries

Proprietary

Google ML Kit

https://developers.google.com/ml-kit/vision/text-recognition/v2/android

Capable of getting points, boxes, and more for rendering.

https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock

Pros
  1. Google Services devices can just use MLKit
  2. Minimal app size increase.
Cons
  1. Google Services.

Open Source

Tesseract4Android

https://github.com/adaptech-cz/Tesseract4Android

Pros
  1. Android
  2. Not too large library size
  3. Performant (sub 1 second in emulator on single thread)
Cons
  1. Somewhat clunky codebase
  2. Developers are not active, only maintaining
  3. Have to download models separately

Aspire

https://asprise.com/royalty-free-library/java-ocr-source-code-examples-demos.html

tess4j

https://github.com/nguyenq/tess4j