Completati primi test di calcoli qta da evadere

This commit is contained in:
2020-03-30 11:49:13 +02:00
parent cbce52fd83
commit f619dece3b
12 changed files with 218 additions and 67 deletions

View File

@@ -38,20 +38,22 @@ internal class BarcodeAnalyzer(
return
}
val data = ByteArray(byteBuffer.remaining()).also { byteBuffer.get(it) }
var data = ByteArray(byteBuffer.remaining()).also { byteBuffer.get(it) }
var width = image.width
var height = image.height
val rotatedData = ByteArray(data.size)
for (y in 0 until height) {
for (x in 0 until width) rotatedData[x * height + height - y - 1] = data[x + y * width]
}
val tmp = width
width = height
height = tmp
// val rotatedData = ByteArray(data.size)
// for (y in 0 until height) {
// for (x in 0 until width) rotatedData[x * height + height - y - 1] = data[x + y * width]
// }
//
// data = rotatedData
// val tmp = width
// width = height
// height = tmp
val source = PlanarYUVLuminanceSource(rotatedData, width, height, 0, 0, width, height, false).let {
val source = PlanarYUVLuminanceSource(data, width, height, 0, 0, width, height, false).let {
if (inverted) it.invert() else it
}
val bitmap = BinaryBitmap(HybridBinarizer(source))