rememberBarcodeScanner
Use a BarcodeScanner (the equivalent of VisionCamera's useBarcodeScanner).
A BarcodeScanner can be used to detect Barcodes in a Frame in a Frame Processor, or in an existing Image. It is kept across recompositions, recreated when the BarcodeScannerOptions.barcodeFormats change, and disposed once it leaves the composition (where V5 lets the garbage collector release it).
val barcodeScanner = rememberBarcodeScanner(BarcodeScannerOptions(listOf(TargetBarcodeFormat.ALL_FORMATS)))
val frameOutput = rememberFrameOutput { frame ->
frame.use {
val barcodes = barcodeScanner.scanCodes(it)
println("Detected ${barcodes.size} barcodes!")
}
}Parameters
The formats to scan for.
Use a BarcodeScanner scanning for the given barcodeFormats (the equivalent of VisionCamera's useBarcodeScanner({ barcodeFormats })).
A BarcodeScanner can be used to detect Barcodes in a Frame in a Frame Processor, or in an existing Image. It is kept across recompositions, recreated when the barcodeFormats change, and disposed once it leaves the composition (where V5 lets the garbage collector release it).
val barcodeScanner = rememberBarcodeScanner(listOf(TargetBarcodeFormat.ALL_FORMATS))
val frameOutput = rememberFrameOutput { frame ->
frame.use {
val barcodes = barcodeScanner.scanCodes(it)
println("Detected ${barcodes.size} barcodes!")
}
}Parameters
The formats to scan for. To detect all kinds of barcodes, use listOf(TargetBarcodeFormat.ALL_FORMATS).