Enable OCR VIN support

What is OCR VIN Support #

OCR support in the barKoder SDK is currently intended primarily for VIN code recognition. Since the SDK is focused on barcode scanning, our OCR implementation has been optimized specifically for VIN use cases.

At this time, OCR is not designed to function as a general document scanner.

To enable VIN OCR in the barKoder SDK:

First Ensure you're using a license key that has OCR enabled.

Add ML KIT dependency in app build.gradle #

                dependencies {
    implementation "com.google.mlkit:text-recognition:16.0.1"}
}
            

Enable OCR in the decoder configuration #

                Barkoder.SetCustomOption(bkdView.config.getDecoderConfig(), "enable_ocr_functionality", 1);
            

Available symbologies #

As mentioned in the VIN section of our site, VIN scanning works with the following symbologies:

                private fun setVinMode() {
    bkdView.config = BarkoderConfig(this, "LICENSE_KEY") {
        Log.i("Licensing SDK: ", it.message)
    }    // Enabling code39, code128, datamatrix, ocr and qr
    bkdView.config.decoderConfig.Code39.enabled = true
    bkdView.config.decoderConfig.Code128.enabled = true
    bkdView.config.decoderConfig.Datamatrix.enabled = true
    bkdView.config.decoderConfig.QR.enabled = true
    bkdView.config.getDecoderConfig().OCRText.enabled = true;    // For best result decoding speed should be slow, and barkoder resolution should be high
    bkdView.config?.decoderConfig?.decodingSpeed = Barkoder.DecodingSpeed.Slow
    bkdView.config?.barkoderResolution = BarkoderResolution.HIGH
    bkdView.config.isRegionOfInterestVisible = true
    bkdView.config.setRegionOfInterest(0f, 30f, 100f, 40f)
    bkdView.config.decoderConfig.enableVINRestrictions = true
}
            

The SDK will first attempt to extract the VIN from supported barcode formats such as Code 39, Code 128, Data Matrix, or QR codes. If barcode decoding is unsuccessful due to poor lighting or other conditions, the SDK will fall back to OCR and decode the visible text portion of the VIN, which is typically readable to the naked eye. This approach ensures the most reliable and optimal results.

Release Information #

OCR VIN has been added in version 1.6.7

Page Contents