Barcode reading using picture taken using mobile phone camera
Asked Answered
P

6

11

How do we do programmatic reading of a barcode that is captured using a mobile phone camera? For example, how do that using iPhone or Android or Java ME? Do we need separate hardware to read bar code or can we do image manipulation?

Perturb answered 27/8, 2009 at 9:15 Comment(0)
G
19

Google has made this INCREDIBLY simple with their Zebra Crossing libraries. They have support for doing scanning via images on the following platforms:

  • J2SE
  • Android

and others have ported to:

  • J2ME
  • CSharp
  • CPP
  • Rim
  • iPhone
  • Bug

As another poster already mentioned, on Android you could also use an Intent to call Barcode Reader with something like:

public Button.OnClickListener mScan = new Button.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.putExtra("SCAN_MODE", "ONE_D_MODE");
        startActivityForResult(intent, 0);
    }
};

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }
}
Greylag answered 27/8, 2009 at 10:59 Comment(1)
the problem with ZXing - last time i checked - was that it did not work with fixed-focus cam, that most cell (cheap || iPhone 2G) phones haveApplicatory
A
4

Barcodes can be read through analysis taken from phone cameras.

A well-known complication is that fixed-focus cameras (like on the older 2G/3G iPhones and some Androids) cannot take in-focus snapshot form short distances. To counter that, special "deconvoluting" algorithms have to be used - and last time i checked this was not part of the Zebra Crossing.

Some have implemented solutions - i am aware of the following apps for iPhone who can read UPCs with fixed-focus camera: pic2shop (Benoit Maison / Vision Smarts), RedLaser (Occipital) and ShopSavvy (Big in Japan) - check them out and i think all of them have available SDKs for interested 3rd parties.

Applicatory answered 7/12, 2009 at 4:19 Comment(2)
Could you explain what you mean by in-focus snapshot and the special de-convoluting algorithm?Credible
It's 'deconvolution'-- 'de-convoluting' is not the correct term.Elea
R
2

For Android it's very easy. Simply use the service provided by the Barcode Scanner app (dependancy). Then the Barcode Scanner app will handle all of the scanning part and will simply return you the code.

I think similar solutions are available for other platforms, but in Android it's even easier because of its Intent architecture.

Rodl answered 27/8, 2009 at 9:24 Comment(0)
A
1

I'd recommend picking a solution that also decodes barcodes in blurry images. There are many low-end Android phones out there that only have fixed focus cameras and which require more sophisticated image processing solutions than the binary thresholding that the software solutions listed above offer. Examples of such more advanced solutions include redlaser or the Scandit barcode scanner SDK.

The Scandit SDK is very easy to integrate and comes with a free community edition. There is also a product API that makes it straightforward to convert barcode numbers into product names.

Disclaimer: I am one of the co-founders of Scandit.

Ashtoreth answered 25/9, 2012 at 12:19 Comment(0)
J
0

Obviously it's possible to read the bar code from an image of it. You probably need to think about issues like

  • Orientation; perhaps the photo is not straight-on, so the bars aren't vertical. Also, it might be upside-down ...
  • Focus; what if the shot is blurry? There probably is a limit where it becomes impossible to interpret it safely.
  • Cropped; what if the framing is bad, so the entire code isn't even in the image?

There are lots of existing projects and products that solve this ... Here is one, for instance. Some solutions seem to not be very sensitive to points like those above, but claim to be able to find and recognize bar codes regardless of orientation and location in the image, for instance.

Juneberry answered 27/8, 2009 at 9:19 Comment(0)
D
0

Just for an update to all the newbies looking for an answer to this question, Google now offers Barcode Detection Apis via Google Play Services to simplify scanning barcode using phone's camera. No more need to depend on Third Party Apis.

Disgraceful answered 4/9, 2015 at 5:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.