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?
Google has made this INCREDIBLY simple with their Zebra Crossing libraries. They have support for doing scanning via images on the following platforms:
and others have ported to:
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
}
}
}
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With