Skip to main content

Detection on the Image | Flutter Barcode Scanner

Barcode Detection from Still Image

var result = ScanbotBarcodeSdk.detectBarcodesOnImage(Uri file,
{List<BarcodeFormat> barcodeFormats = const <BarcodeFormat>[],
BarcodeAdditionalParameters? additionalParameters,
List<BarcodeDocumentFormat> acceptedDocumentFormats = const <BarcodeDocumentFormat>[]})

This method provides the functionality of detecting barcodes from a still image, e.g. a JPG image from Photo Library or other source. The image must be passed as a file URI.

Parameters:

  • Uri file - A valid file URI of the image (e.g. file:///some/path/image-with-barcodes.jpg). Supported image formats are JPG and PNG. Please make sure your app has the read permission to access this file.
  • BarcodeAdditionalParameters? additionalParameters - additional parameters for barcodes detection and filtering.
  • List<BarcodeFormat> barcodeFormats - Optional list of barcode formats to recognize.
  • List<AcceptedDocumentFormats> acceptedDocumentFormats - Optional list of accepted documents formats to recognize.
/// Detect barcodes from the given images list
var result = ScanbotBarcodeSdk.detectBarcodesOnImages(List<Uri> imageFileUris,
{List<BarcodeFormat> barcodeFormats = const <BarcodeFormat>[],
BarcodeAdditionalParameters? additionalParameters,
List<BarcodeDocumentFormat> acceptedDocumentFormats = const <BarcodeDocumentFormat>[]})
}

Parameters:

  • List<Uri> imageFileUris - A list of valid file URIs of the images (e.g. file:///some/path/image-with-barcodes.jpg). Supported image formats are JPG and PNG. Please make sure your app has the read permission to access this file.
  • BarcodeAdditionalParameters? additionalParameters - additional parameters for barcodes detection and filtering.
  • List<BarcodeFormat> barcodeFormats - Optional list of barcode formats to recognize.
  • List<AcceptedDocumentFormats> acceptedDocumentFormats - Optional list of accepted documents formats to recognize.
/// A class that contains additional parameters for barcodes detection and filtering.
class BarcodeAdditionalParameters {
/// GS1 handling mode
Gs1HandlingMode? gs1HandlingMode;
/// Minimum required text length of the detected barcode.
/// The default is 0.
/// NOTE: Currently works for ITF barcodes only!
int? minimumTextLength;
/// Maximum text length of the detected barcode. Setting to zero removes the limit.
/// The default is 0.
/// NOTE: Currently works for ITF barcodes only!
int? maximumTextLength;
/// Minimum required quiet zone on the barcode. Measured in modules (the size of minimal bar on the barcode).
/// The default is 10.
/// NOTE: Currently works for ITF barcodes only!
int? minimum1DBarcodesQuietZone;
/// The checksum algorithm for MSI Plessey barcodes.
/// The default value is `Mod10'
MSIPlesseyChecksumAlgorithm? msiPlesseyChecksumAlgorithm;
/// With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes. Has no effect if both single and double digit MSI Plessey checksums are enabled. The default is `false`
bool? stripCheckDigits;
/// The expected density of QR codes in an image.
CodeDensity? codeDensity;
}

Result:

  • result.barcodeItems - List of recognized barcodes as items of BarcodeItem type.

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top