googlesamples / googlesamples/mlkit

[Bug report] barcode Scan zoomcallback grow to a big number

Open
#925 0 comments 0 reactions 1 assignee Claimed by @zhouyiself View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
barcodescanning version 17.3.0
When I apply barcodescanning zoomcallback in my own app,I got this callback log
2025-03-11 19:24:06.045 28269-28269 lsj D Set zoom ratio 2.292537
2025-03-11 19:24:07.575 28269-28269 lsj D Set zoom ratio 8.095027
2025-03-11 19:24:09.085 28269-28269 lsj D Set zoom ratio 30.142937
2025-03-11 19:24:11.623 28269-28269 lsj D Set zoom ratio 123.46548
2025-03-11 19:24:14.030 28269-28269 lsj D Set zoom ratio 521.3553
2025-03-11 19:24:15.535 28269-28269 lsj D Set zoom ratio 1977.2883
2025-03-11 19:24:17.040 28269-28269 lsj D Set zoom ratio 7499.0493
2025-03-11 19:24:18.553 28269-28269 lsj D Set zoom ratio 28440.84
2025-03-11 19:24:20.084 28269-28269 lsj D Set zoom ratio 105903.34
2025-03-11 19:24:21.625 28269-28269 lsj D Set zoom ratio 401648.25
2025-03-11 19:24:23.667 28269-28269 lsj D Set zoom ratio 1552029.5
2025-03-11 19:24:25.220 28269-28269 lsj D Set zoom ratio 5543993.0
2025-03-11 19:24:26.942 28269-28269 lsj D Set zoom ratio 1.935358E7
2025-03-11 19:24:30.431 28269-31450 lsj D Set zoom ratio 1.0

why the zoom ratio is so big

**To Reproduce**
my code is like this

```

if (scanner == null) {
var zoomCallback: ZoomCallback? = null
zoomCallback = ZoomCallback { zoomLevel: Float ->
Log.d("lsj", "Set zoom ratio $zoomLevel")
true
}
val options =
BarcodeScannerOptions.Builder()
.setZoomSuggestionOptions(ZoomSuggestionOptions.Builder(zoomCallback)
.build())
.build()
scanner = BarcodeScanning.getClient(options)

}

val buffer = ByteBuffer.wrap(data)
// [START run_detector]
val image = InputImage.fromByteBuffer(
buffer,
/* image width */ previewWidth,
/* image height */ previewHeight,
0,
InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12
)

val result = scanner?.process(image)

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.