Giter Club home page Giter Club logo

realtimebarcodetracker's Introduction

Real-time Barcode Tracker (Android NDK + OpenCV)

The goal of this project is to track and decode multiple barcodes and show bounding boxes around them.

Currently this can detect a single barcode and display a bounding box around it in realtime.

This uses Android NDK Camera API to access the camera from the native (C++) layer and then draw the preview on a SurfaceView using the NDK ANativeWindow.
Using OpenCV to generate the bounding box with some image processing.
This NDK solution will give much better FPS rather than using OpenCV on the Java layer (with CameraBridgeViewBase.CvCameraViewListener2, can be found in "BarcodeTrackingJava" branch).

Demo

demo gif

Prerequisites

How to setup

  • Clone or download the repo and open "NativeBarcodeTracker" project using Android Studio.
  • Change the OpenCV Android SDK library path in CMakeLists.txt file to your downloaded OpenCV-android-sdk path.

How to run on platforms other than arm64-v8a

To make compiling faster and to minimize the project size I only have it load and run ARM 64-bit (arm64-v8a). To add a different abi architecture, lets take ARM 32-bit (armeabi-v7a) as an example:

  • In the build.gradle file add , "-DANDROID_ABI=armeabi-v7a" in arguments and , armeabi-v7a in abi-filters. (You can also replace it with arm64-v8a)
  • Go into the downloaded OpenCV Android SDK and copy OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_java3.so file into jniLibs folder by creating a directory named armeabi-v7a.

Acknowledgments

CV_Main.cpp, CV_Main.h, Native_Camera.cpp, Native_Camera.h and Util.h were initially taken from sjfricke/OpenCV-NDK project. It helped a lot to understand the implementation of the NDK camera along with the native surface window.

Image_Reader.cpp and Image_Reader.h were taken from googlesamples/android-ndk/camera project. Google NDK camera sample is also a great source to understand the NDK camera implementation.

OpenCV barcode detection algorithm initially taken from https://www.pyimagesearch.com/2014/11/24/detecting-barcodes-images-python-opencv/ tutorial. It explains the algorithm step-by-step.

realtimebarcodetracker's People

Contributors

aa9833 avatar amilacg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.