Barcode reading using picture taken using mobile phone camera

前端 未结 6 1119
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 05:33

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 har

6条回答
  •  忘了有多久
    2021-01-30 06: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
            }
        }
    }
    

提交回复
热议问题