mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

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

Open JasonLinkinBright opened this issue 10 months ago • 0 comments

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)

JasonLinkinBright avatar Mar 11 '25 11:03 JasonLinkinBright