Tweak new QR processing some more.

This commit is contained in:
Cody Henthorne
2022-06-01 14:39:42 -04:00
parent f4c728f57c
commit 4c44f1ee02
4 changed files with 5 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ class QrProcessor {
val source = PlanarYUVLuminanceSource(data, width, height, 0, 0, width, height, false)
val bitmap = BinaryBitmap(HybridBinarizer(source))
val result: Result? = reader.decode(bitmap, emptyMap<DecodeHintType, String>())
val result: Result? = reader.decode(bitmap, mapOf(DecodeHintType.TRY_HARDER to true, DecodeHintType.CHARACTER_SET to "ISO-8859-1"))
if (result != null) {
return result.text

View File

@@ -74,12 +74,12 @@ internal class ScannerView21 constructor(
val preview = Preview.Builder().build()
val imageAnalysis = ImageAnalysis.Builder()
.setTargetAspectRatio(AspectRatio.RATIO_16_9)
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()
imageAnalysis.setAnalyzer(analyzerExecutor) { proxy ->
val buffer = proxy.planes[0].buffer
val buffer = proxy.planes[0].buffer.apply { rewind() }
val bytes = ByteArray(buffer.capacity())
buffer.get(bytes)