QrX: Camera with ML Kit QR/Barcode detection

Overview

QrX: Camera with ML Kit QR/Barcode detection

This library allows you to easily add CameraX Preview with attached ML Kit to detect and display Qr codes and Barcodes. It provides QrXScanner layout component with all underlying logic attached.

Binaries

allprojects {
    repositories {
        maven(url = uri("https://jitpack.io"))
    }
}

dependencies{
    implementation("com.github.Luteoos:qrx:1.0.1")
}

For snapshots and non-released version see guide on Jitpack.io

⚠️ Warning

Becasue QrX exposes via listener com.google.mlkit.vision.barcode.common.Barcode I've decided to import Google ML Kit as an api dependency. Be aware of this as it might cause problems if you use this dependency on its own in your project.

    api("com.google.mlkit:barcode-scanning:17.0.2")

Build

$ git clone https://github.com/Luteoos/qrx.git
$ cd qrx/
$ ./gradlew build

Quick start

">
<layout>


<io.github.luteoos.qrx.QrXScanner
            android:id="@+id/qrxPreview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
            

layout>
private val permissionRequestCamera = registerForActivityResult(ActivityResultContracts.RequestPermission()) {
        binding.cameraBarcode.onPermission(it)

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.qrxPreview.initialize(
            this, 
            {   // onBarcodeClickListener
            },{ //onPermissionRetryListener
            })
        permissionRequestCamera.launch(Manifest.permission.CAMERA)
}

There is possibility to set listener on every detection result:

    binding.qrxPreview.onBarcodeScannedListener = {
        // List
    }

It will be invoked every ImageAnalysis.Analyzer cycle, no user interaction required

Customization

Resources

ID Type Description
qrx_permission_denied_info_text String Text requesting user to allow access to camera
qrx_permission_denied_button_text String Text displayed on request permission button
qrx_analysis_list_buffer Integer Buffer size for list holding detection results, each refresh first result with most detected QR/Barcodes will be used to draw UI
qrx_analysis_ui_refresh_delay Integer (ms) Determines ms between each UI redraw, implemented due to severe performance and usability difference between different classes of hardware
qrx_spacer Dimen (dp) Spacer used in layout
qrx_big_spacer Dimen (dp) Spacer used in layout
colorAccent Color #8883D2 #8883D2
colorAccentLight Color #bab3ff #bab3ff
colorBackground Color #212121 #212121
colorBackgroundTransparent Color #F0212121

View components

In runtime you can access and modify View components via

    binding.qrxPreview.findViewWithTag<TYPE>(QrXScanner.COMPONENT_TAG)
COMPONENT_TAG TYPE
CAMERA_PREVIEW androidx.camera.view.PreviewView
CAMERA_OVERLAY ImageView
CAMERA_TORCH_BUTTON ToggleButton
PERMISSION_DENIED_LAYOUT LinearLayout
PERMISSION_DENIED_TEXT TextView
PERMISSION_DENIED_BUTTON Button

License

MIT License

Copyright (c) 2022 Mateusz Lutecki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You might also like...
Barcode Scanner Libraries for Android
Barcode Scanner Libraries for Android

Project Archived July 1 2020 This project is no longer maintained. When I first started this project in late 2013 there were very few libraries to hel

Barcode scanner library for Android, based on the ZXing decoder

ZXing Android Embedded Barcode scanning library for Android, using ZXing for decoding. The project is loosely based on the ZXing Android Barcode Scann

Barcode Scanner Libraries for Android
Barcode Scanner Libraries for Android

Project Archived July 1 2020 This project is no longer maintained. When I first started this project in late 2013 there were very few libraries to hel

Yet another barcode scanner for Android
Yet another barcode scanner for Android

Binary Eye Yet another barcode scanner for Android. As if there weren't enough. This one is free, without any ads and open source. Works in portrait a

A library to help implement barcode scanning
A library to help implement barcode scanning

A library to help implement barcode scanning

Android app and Python library for turning mobile phone into a WebSocket-based, remotely controllable Barcode/QR code reader

Remote Barcode Reader suite Android app and Python library for turning mobile phone into a remotely controllable Barcode/QR code reader. It exposes a

This app contains feature barcode and QR scanner, and video recording in-app.

BarcodeQRScannerAndVideoRecord This app contains feature barcode and QR scanner, and video recording in-app. Scanner using ML Kit and CameraX. Video R

On-device wake word detection powered by deep learning.
On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

With Viola android face detection library, you can detect faces in a bitmap, crop faces using predefined algorithm and get additional information from the detected faces.
With Viola android face detection library, you can detect faces in a bitmap, crop faces using predefined algorithm and get additional information from the detected faces.

Viola Viola android face detection library detects faces automatically from a bitmap, crop faces using the predefined algorithms, and provides supplem

A memory leak detection library for Android.

LeakCanary 🐤 A memory leak detection library for Android. square.github.io/leakcanary License Copyright 2015 Square, Inc. Licensed under the Apache

Android device shake detection.

Seismic Android device shake detection. Download Download the latest .jar or depend via Maven: dependency groupIdcom.squareup/groupId artif

[Android] Screenshot detection while user using your app
[Android] Screenshot detection while user using your app

[Android] Screenshot detection while user using your app

An Android project containing image recognition and object detection models.
An Android project containing image recognition and object detection models.

An Android project containing image recognition and object detection models. Users can input images into the deep learning model by taking photos, opening photo albums, and real-time previews on the Android side. After the calculation on the Android side is completed, the model will output the prediction result and show it to the user.

This app using Mlkit along with the TensorFlow Lite model for object detection,

I built this app using Mlkit along with the TensorFlow Lite model for object detection, Arcore is used to place anchors to the detected objects. It's a good blend of Machine learning and Augmented reality to visualise ML information in a much better way than regular bounding boxes

TensorFlow Lite Object Detection Android Demo
TensorFlow Lite Object Detection Android Demo

GSoC Project 2021 - TensorFlow Description This repository contains the project where I contributed to the TensorFlow Team during GSoC in the year 202

On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

Web-based media manager with duplication detection, tagging, and more
Web-based media manager with duplication detection, tagging, and more

reelchest 📦 🎞️ 📽️ A basic web-based media manager. Download or upload clips,

A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK
A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK

Vision Sample (Android) A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK. You can checkou

Based on Android + NodeMCU platform to achieve object detection and tracking, AI capabilities come from Google MLKit.
Based on Android + NodeMCU platform to achieve object detection and tracking, AI capabilities come from Google MLKit.

Based on Android + NodeMCU platform to achieve object detection and tracking, AI capabilities come from Google MLKit.

Releases(1.0.1)
Owner
Mateusz Lutecki
Bachelor of Engineering of the Silesian University of Technology; Intrests focused Android with Kotlin
Mateusz Lutecki
Barcode scanner library for Android, based on the ZXing decoder

ZXing Android Embedded Barcode scanning library for Android, using ZXing for decoding. The project is loosely based on the ZXing Android Barcode Scann

JourneyApps 5.3k Jan 4, 2023
A library to help implement barcode scanning

A library to help implement barcode scanning

Brightec 99 Nov 30, 2022
Android app and Python library for turning mobile phone into a WebSocket-based, remotely controllable Barcode/QR code reader

Remote Barcode Reader suite Android app and Python library for turning mobile phone into a remotely controllable Barcode/QR code reader. It exposes a

Krystian Dużyński 3 Dec 6, 2022
ML Kit & CameraX Reader POC

LeitorUnificadoPoc ML Kit & CameraX Reader POC Funcionalities description Barcode and QR Code reader Tech stack Minimum SDK level 21 Kotlin based + Co

hush 2 Mar 17, 2022
SmartLens uses Google's ML Kit for Barcode scanning, Face recognition, Text recognition, and Image labeling.

SmartLens SmartLens uses Google's ML Kit for Barcode scanning, Face recognition, Text recognition, and Image labeling. ?? Screen Shots ?? Features It

Prince Fahad 2 Sep 14, 2022
Android barcode scanner with ML-Kit vision api

MLBarcodeScanner A demo project to show how to implement barcode scanner using Google ML-Kit Vision api Supported barcode types 2D formats: QR Code, A

Mahdi Javaheri 5 Dec 26, 2022
Frogo Android UI Kit - Frogo UI Design Kit Guideline

About This Project Follow-up project from frogo-ui-kit UI Kit for helping you in apps development Migrate from frogo-ui-kit Just renaming package com.

Frogobox 6 Nov 25, 2022
Camera Folder: "Take a Photo from Camera" everywhere where you can open a photo file

When "Camera Folder" is installed many Android-Apps that can open jpg files can also take a photo from camera.

k3b 18 Dec 20, 2022
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Dec 27, 2022