Fix QR scanning issues.

This commit is contained in:
Cody Henthorne
2022-08-10 11:20:50 -04:00
committed by Alex Hart
parent 019025ab8a
commit eefd7bd37a
5 changed files with 56 additions and 2 deletions

View File

@@ -45,6 +45,8 @@ class QrProcessor {
previousHeight = source.height
}
listener?.invoke(source)
val bitmap = BinaryBitmap(HybridBinarizer(source))
val result: Result? = reader.decode(bitmap, mapOf(DecodeHintType.TRY_HARDER to true, DecodeHintType.CHARACTER_SET to "ISO-8859-1"))
@@ -65,5 +67,7 @@ class QrProcessor {
companion object {
private val TAG = Log.tag(QrProcessor::class.java)
var listener: ((LuminanceSource) -> Unit)? = null
}
}

View File

@@ -74,7 +74,7 @@ internal class ScannerView21 constructor(
val preview = Preview.Builder().build()
val imageAnalysis = ImageAnalysis.Builder()
.setTargetResolution(Size(1920, 1080))
.setTargetResolution(Size(1280, 960))
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()