Barcode scanning
Last updated
Last updated
The SDK can detect barcodes located on the packaging of packaged foods. To implement real-time barcode scanning, the is needed.
Specifically for barcode scanning, these steps are required:
When defining a FoodDetectionConfiguration
object, enable the detectBarcode
flag.
In the recognitionResults
callback, check the property candidate.barcodeCandidates
. If this list is empty, no barcodes have been recognised.
If there is a single or multiple barcode candidates, use their value property and invoke this function to fetch the .
To recognise a barcode in an image, refer to the function. The result of the barcode scanning process will come in the packagedFoodItem
attribute, and the resultType will be Barcode.
Set up the camera preview and detection session to recognise barcodes
Create a result view with two states: search and result
If the candidate.barcodeCandidates is empty, show the search state. Else, fetch the PassioFoodItem, and use it's name and icon to show the result
Example of an image that produces multiple BarcodeCandidates: