Skip to content

Migrate scanner flow to zxing-cpp with CameraX#515

Open
nielstron wants to merge 4 commits intoSeineEloquenz:mainfrom
nielstron:feat/zxing-cpp-scanner-2
Open

Migrate scanner flow to zxing-cpp with CameraX#515
nielstron wants to merge 4 commits intoSeineEloquenz:mainfrom
nielstron:feat/zxing-cpp-scanner-2

Conversation

@nielstron
Copy link
Contributor

@nielstron nielstron commented Feb 26, 2026

This migrates the scanner away from zxing (which is barely maintained) to zxing-cpp. A neat side effect is that the scanning is much faster and catches more difficult/blurred/smaller/etc pictures.
Screenshot_1772178311

@SeineEloquenz
Copy link
Owner

This is interesting. I don't know the zxing-cpp lib, but if this can also write codes the same way as the other zxing lib did, maybe we could get rid of that one completely.

@nielstron
Copy link
Contributor Author

Unfortunately it looks like zxing-cpp does not support code generation

@nielstron
Copy link
Contributor Author

The only reasonable alternative to zxing for generation I see so far is https://github.com/woo-j/OkapiBarcode which at least had updates as recently as two weeks ago and seems to support a decent amount of configurable settings, and would avoid all the baggage from zxing for scanning/views that we don't need.

@nielstron
Copy link
Contributor Author

nielstron commented Feb 28, 2026

I explored how difficult it would be to migrate to okapi and seems not very hard. One qualm I have is that I don't know how many issues like #491 or #184 will appear. We don't really have a test suite for this yet I guess?

@SeineEloquenz
Copy link
Owner

SeineEloquenz commented Feb 28, 2026

No we don't. The problem is that most of the passes I could use for testing contain potentially PII so I can't upload to GitHub. If I anonymize the data, I don't know whether they would still be representative. We had issues like #184 where newer zxing versions render codes that are technically correct, but some scanners don't implement the necessary functionality (ECI), so round trip tests would not help either. I guess we would have to check in the actual expected bitmatrices to get a reliable suite.

We absolutely need a test suite to prevent such regressions before I am willing to change anything related to zxing. But even with the passes I have there is still a lot of risk, because I only got like 20 or so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants