Giter Site home page Giter Site logo

zxing / zxing Goto Github PK

View Code? Open in Web Editor NEW
32.3K 1.7K 9.3K 237.25 MB

ZXing ("Zebra Crossing") barcode scanning library for Java, Android

License: Apache License 2.0

Java 96.23% HTML 3.64% CSS 0.13%
java android barcode barcode-scanner zxing qr-code datamatrix upc

zxing's Introduction

Project in Maintenance Mode Only; Barcode Scanner not available

The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enhancements will be considered. The Barcode Scanner app can no longer be published, so it's unlikely any changes will be accepted for it. It does not work with Android 14 and will not be updated. Please don't file an issue for it. There is otherwise no active development or roadmap for this project. It is "DIY".

Get Started Developing

To get started, please visit: https://github.com/zxing/zxing/wiki/Getting-Started-Developing

ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

Supported Formats

1D product 1D industrial 2D
UPC-A Code 39 QR Code
UPC-E Code 93 Data Matrix
EAN-8 Code 128 Aztec
EAN-13 Codabar PDF 417
UPC/EAN Extension 2/5 ITF MaxiCode
RSS-14
RSS-Expanded

Components

Active

Module Description
core The core image decoding library, and test code
javase JavaSE-specific client code
android Android client Barcode Scanner
android-integration Supports integration with Barcode Scanner via Intent
android-core Android-related code shared among android, other Android apps
zxingorg The source behind zxing.org
zxing.appspot.com The source behind web-based barcode generator at zxing.appspot.com

Available in previous releases

Module Description
cpp C++ port
iphone iPhone client
objc Objective C port
actionscript Partial ActionScript port
jruby JRuby wrapper

ZXing-based third-party open source projects

Module Description
SCodes Qt & Qml wrapper
QZXing port to Qt framework
glassechidna/zxing-cpp port to C++ (forked from the deprecated official C++ port)
zxing-cpp/zxing-cpp latest/active port to C++, includes Android, C, iOS, .NET, Rust, Python, WASM and WinRT wrappers
zxing_cpp.rb bindings for Ruby (not just JRuby), powered by zxing-cpp
jsqrcode port to JavaScript
python-zxing bindings for Python
ZXing .NET port to .NET and C#, and related Windows platform
php-qrcode-detector-decoder port to PHP
ZXing Delphi Port to native Delphi object pascal, targeted at Firemonkey compatible devices (IOS/Android/Win/OSX) and VCL.
ZXingObjC Port to Objective-C
php-zxing PHP wrapper to Zxing Java library
zxing-js/library TypeScript port of ZXing library
pyzxing Python wrapper to ZXing library
zxing-dart Port to dart
rxing Port to rust

Other related third-party open source projects

Module Description
Barcode4J Generator library in Java
BoofCV Generator and reader library in Java
ZBar Reader library in C99
OkapiBarcode Generator library in Java

Links

Etcetera

codecov

QR code is trademarked by Denso Wave, inc. Thanks to Haase & Martin OHG for contributing the logo.

Optimized with JProfiler

zxing's People

Contributors

alexgeller1 avatar axxel avatar az-ericso avatar benjohnde avatar burunduk avatar dehnhard avatar dependabot[bot] avatar dlenski avatar dsanders11 avatar fgrieu avatar gitlost avatar gredler avatar makiuchi-d avatar matrix44 avatar medicalwei avatar mertemin avatar mhcuervo avatar michelemas avatar micjahn avatar mikejkjr avatar odahcam avatar primo-ppcg avatar qingfenglee avatar slepmog avatar srowen avatar t-8ch avatar tanelihuuskonen avatar uniqp avatar xuthus avatar yoshi389111 avatar

Stargazers

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

Watchers

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

zxing's Issues

Provide android fragment to easily integrate zxing in an android application

Hi,

For a project I am currently working on I needed to add bar code scanning capabilities. After looking at some options I found
https://github.com/kennydude/zxing-lib and the fork
https://github.com/Skookum/zxing-android

That provided easy integration of the zxing library in an android app via a fragment. There were some issues in the code and I cleaned it up somewhat (https://github.com/sjaakieb/zxing-android).

I found that a large part of the code came from your zxing android project. It would be nice for a lot of developers if you could support this. Kenny indicated that he won't support it anymore but I would be happy to help you accomplish this.

Greetings,

Jacques

CaptureActivity crash

My application kepp crashing when I intent to another class after using the CaptureActivity class.
Can someone help me plz
Thanks

Validation for custom search URL fails

The validation code for the custom search URL in PreferencesFragment seems to pass the user input to the URL class without removing the placeholders (%s etc).
Unfortunately this seems to yield a syntax error on KitKat as %s is not a valid escape code and thus prevents the use of a custom search URL.
If I replace the % with %25 (escaped %) the URL is accepted but the Barcode contents does not get inserted.
Test case: KitKat on Galaxy S4
URL rejected: https://www.google.com/search?q=%s
URL accepted but not working: https://www.google.com/search?q=%25s

Inserting the rejected URL directly into the preferences file (as root) works as expected.

Possible solution: Substitution of the placeholders with an empty string prior to the validation.

WhiteRectangleDetector and high-resolution images

Hi,

With high resolution images, the WhiteRectangleDetector is detecting white rectangles INSIDE DataMatrix barcodes.

A possible solution would be to make INIT_SIZE a variable, and base the value on the overall dimensions of the image.

If that is not feasible, maybe you could make the value settable somehow from a Reader or DataMatrixReader.

Thanks for all your work creating and maintaining this project!

Regards,
Todd Gibson

Zxing 2.0 with flashing screen

I have used Zxing 2.0 on an app. It worked fine. But recently I found that the scanning screen keeps flashing. It happens on Samsung Galaxy Notes 3. another testing smartphone Nexus S doesnt have this problem. What can I do? Thanks.

Possible ReedSolomon decoding problem

I have been working on improving the javascript port the zxing QR code reader and i found that the ReedSolomon decoder would sometimes return incorrect data as a valid decode.

I corrected this problem by checking if the corrected data had any errors fail if so.

I don't really mess with java so I am not sure if the same issue exists here.

if the issue dose in fact exist see the tail end of this post for a fix that i think is valid java code :)

Thank you for contribution to open source,
Kenneth W Lichtenberger

// code to implement a fix
private void check(int[] received, int twoS) throws ReedSolomonException { // check if the received data has errors and throw if so
GenericGFPoly poly = new GenericGFPoly(field, received);

for (int i = 0; i < twoS; i++) {
  int eval = poly.evaluateAt(field.exp(i + field.getGeneratorBase()));
  if (eval != 0) {
    throw new ReedSolomonException("Uncorrectable block");
  }
}

}

public void decode(int[] received, int twoS) throws ReedSolomonException {
GenericGFPoly poly = new GenericGFPoly(field, received);
int[] syndromeCoefficients = new int[twoS];
boolean noError = true;
for (int i = 0; i < twoS; i++) {
int eval = poly.evaluateAt(field.exp(i + field.getGeneratorBase()));
syndromeCoefficients[syndromeCoefficients.length - 1 - i] = eval;
if (eval != 0) {
noError = false;
}
}
if (noError) {
return;
}
GenericGFPoly syndrome = new GenericGFPoly(field, syndromeCoefficients);
GenericGFPoly[] sigmaOmega =
runEuclideanAlgorithm(field.buildMonomial(twoS, 1), syndrome, twoS);
GenericGFPoly sigma = sigmaOmega[0];
GenericGFPoly omega = sigmaOmega[1];
int[] errorLocations = findErrorLocations(sigma);
int[] errorMagnitudes = findErrorMagnitudes(omega, errorLocations);
for (int i = 0; i < errorLocations.length; i++) {
int position = received.length - 1 - field.log(errorLocations[i]);
if (position < 0) {
throw new ReedSolomonException("Bad error location");
}
received[position] = GenericGF.addOrSubtract(received[position], errorMagnitudes[i]);
}
check(received,twoS) // check if the new data has errors

}

Use Android ContactsContract API to properly support birthdays, anniversaries, websites, etc.

Using the ContactsContract API (API level 5) additional VCARD data like birthdays, anniversaries, websites, etc. can be added.

Here a working example for birthdays:

ArrayList<ContentValues> data = new ArrayList<ContentValues>();
ContentValues row1 = new ContentValues();
row1.put(ContactsContract.CommonDataKinds.Contacts.Data.MIMETYPE, ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE);
row1.put(ContactsContract.CommonDataKinds.Event.TYPE, ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY);
row1.put(ContactsContract.CommonDataKinds.Event.START_DATE, bdayString);
data.add(row1);
intent.putParcelableArrayListExtra(ContactsContract.Intent.Insert.DATA, data);

Ported from https://code.google.com/p/zxing/issues/detail?id=1689

Looks like app Settings don't mach default Preferences

Some preferences are checked by default in the preferences.xml file, but when reading them through code the default value is false...
exemple => preferences_decode_1D_product

So unless you open the Settings screen and save it, the app will work erratically .

ITF wide bar width, bar wide to narrow ratio

Hi,

in source file

core/src/main/java/com/google/zxing/oned/ITFReader.java on line 50 we have:

private static final int W = 3; // Pixel width of a wide line

in comment you write "Wikipedia is a great reference for Interleaved 2 of 5 information"
and on Wikipedia site we have: wide line (2.0 to 3.0 times the width of a narrow line).

I implement "Wide To Narrow Ratio" in my barcode generator

http://www.generatorkodowkreskowych.pl/en/itf-14/
http://www.generatorkodowkreskowych.pl/en/2of5-interleaved/

You can generate ITF codes with diffrent wide line width (2 to 3 times the width of a narrow line)

For PNG images you can use:

at scale 100% (narrow bar = 1) and WTNR in [2, 3] wide bar = 2,3
at scale 200% (narrow bar = 2) and WTNR in [2, 2.5, 3] wide bar = 4,5,6
at scale 300% (narrow bar = 3) and WTNR in [2, 2.33, 2.66, 3] wide bar = 6,7,8,9
at scale 400% (narrow bar = 4) and WTNR in [2, 2.25, 2,5, 2.75, 3.0 ] wide bar = 8,9,10,11,12

For PDF files you can use:

scale in range 80% to 200%, Wide To Narrow Ratio in range 2.00 to 3.00 with 0.01 step.

I make tests:

generate codes with Wide/Narrow = 2, and with Wide/Narrow = 2.5, and Wide/Narrow = 3
print codes and read with manual barcode reader Argox AS-8000.

Your barcode reader can not read ITF barcode with Wide To Narrow Ratio = 2,
but can read Code-39 with Wide To Narrow Ratio = [2,3].

I assume this information can help you to improve ITFReader.

Ported from https://code.google.com/p/zxing/issues/detail?id=1831

VCard Data not tranfered to Contact list

Using Samsung Galaxy SII, Android 4.1.2, Barcode Scanner V 4.6.0
Data from scanned QR for a vcard (previewed on screen) is not passed to contact. Contact App is being opened but no no new card is being created.
Can reproduce: Yes, Every single time, regardless of QR generator used.

Cannot add custom search substitutions

In Barcode Scanner (Android) version 4.6.2, it is not possible to add custom search URL substitutions (%s, %f, %t). Any custom search URL that includes the % symbol is rejected, error "Invalid value".

Access scanned barcode history from zxing

I'm using zxing lib from long time, but I need a requirement to display scanned barcode history like how zxing app history!. Is there any best way we can access the history via content provider or HistoryManager.java class?

Appcrash

Version: 4.6.1 from fdroid
Android Version: 4.4.2(CM11)
Device: Moto Defy
Logcat:
E/AndroidRuntime( 9463): FATAL EXCEPTION: Thread-412
E/AndroidRuntime( 9463): Process: com.google.zxing.client.android, PID: 9463
E/AndroidRuntime( 9463): java.lang.ArrayIndexOutOfBoundsException: src.length=460800 srcPos=461039 dst.length=799 dstPos=0 length=799
E/AndroidRuntime( 9463): at java.lang.System.arraycopy(Native Method)
E/AndroidRuntime( 9463): at com.google.zxing.PlanarYUVLuminanceSource.getRow(PlanarYUVLuminanceSource.java:73)
E/AndroidRuntime( 9463): at com.google.zxing.common.GlobalHistogramBinarizer.getBlackRow(GlobalHistogramBinarizer.java:62)
E/AndroidRuntime( 9463): at com.google.zxing.oned.OneDReader.doDecode(OneDReader.java:130)
E/AndroidRuntime( 9463): at com.google.zxing.oned.OneDReader.decode(OneDReader.java:57)
E/AndroidRuntime( 9463): at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:171)
E/AndroidRuntime( 9463): at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:58)
E/AndroidRuntime( 9463): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 9463): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 9463): at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:110)
If you need more informations please ask.

Android app: black screen

Hi,

Thank you for this lib/app, I use it since a long time, but I encountered an issue on a Samsung Galaxy Ace 2: the app opens, but the surface where I should get the camera output stays black (with the red line on it).

Here is the LogCat output:

02-12 21:28:34.182    7764-7764/com.google.zxing.client.android I/com.google.zxing.client.android.camera.open.OpenCameraInterface﹕ Opening camera #0
02-12 21:28:34.422    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Screen resolution: Point(800, 480)
02-12 21:28:34.422    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Supported preview sizes: 1280x720 960x720 800x480 720x480 640x480 352x288 320x240 176x144
02-12 21:28:34.422    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Found preview size exactly matching screen size: Point(800, 480)
02-12 21:28:34.422    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Camera resolution: Point(800, 480)
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Initial camera parameters: sharpness-max=2;brightness-step=1;zoom=0;recording-hint=false;zoom-supported=true;sharpness-min=-2;metering=center;fnumber=2.7;sharpness=0;contrast=0;whitebalance=auto;scene-mode=auto;jpeg-quality=100;preview-format-values=yuv420sp,yuv420p,yuv420mb;jpeg-thumbnail-quality=70;preview-format=yuv420sp;ev-enable=1;preview-size=640x480;focal-length=3.54;iso=auto;flash-mode-values=auto,on,off,torch;preview-frame-rate-values=15,30;preview-frame-rate=30;focus-mode-values=auto,macro,fixed;jpeg-thumbnail-width=320;scene-mode-values=auto,portrait,landscape,night,beach,sunset,dusk-dawn,fall-color,back-light,fireworks,sports,party,candlelight,text;preview-fps-range-values=(10000,31000);jpeg-thumbnail-size-values=400x240,320x240,0x0;zoom-ratios=100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400;record-buffer-count=4;preview-size-values=1280x720,960x720,800x480,720x480,640x480,352x288,320x240,176x144;saturation-step=1;picture-size-values=2560x1920,2560x1536,2048x1536,2048x1232,960x720,640x480;contrast-min=-3;record-mem-handle=0;preview-fps-range=10000,31000;auto-whitebalance-lock=false;min-exposure-compensation=-4;brightness-min=-2;antibanding=50hz;max-num-focus-areas=1;saturation-min=-2;contrast-max=3;vertical-view-angle=66.4;brightness-max=2;horizontal-view-angle=66.4;brightness=0;jpeg-thumbnail-height=240;record-stride=960;focus-mode=auto;contrast-step=1;sharpness-step=1;record-slice-height=480;auto-whitebalance-lock-supported=false;video-frame-format=yuv420mb;picture-format-values=jpeg;saturation-max=2;max-exposure-compensation=4;focus-areas=(-10,-10,10,10,1);video-snapshot-supported=false;exposure-compensation=0;exposure-compensation-step=1;flash-mode=off;auto-exposure-lock=false;effect-values=none,mono,negative,solarize,sepia;picture-size=2560x1920;max-zoom=30;effect=none;saturation=0;whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight;picture-format=jpeg;focus-distances=0.049,0.05,0.051;wdr=0;auto-exposure-lock-supported=false;antibanding-values=auto,50hz,60hz,off
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Supported values: [auto, on, off, torch]
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Settable value: off
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Supported FPS ranges: [[I@41a5f4b0]
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Supported values: [auto, macro, fixed]
02-12 21:28:34.432    7764-7764/com.google.zxing.client.android I/CameraConfiguration﹕ Settable value: auto
02-12 21:28:34.442    7764-7764/com.google.zxing.client.android I/DecodeThread﹕ Hints: {POSSIBLE_FORMATS=[AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E], NEED_RESULT_POINT_CALLBACK=com.google.zxing.client.android.ViewfinderResultPointCallback@41a38e30}
02-12 21:28:35.614    7764-7764/com.google.zxing.client.android I/AutoFocusManager﹕ Current focus mode 'auto'; use auto focus? true
02-12 21:28:35.624    7764-7764/com.google.zxing.client.android I/Choreographer﹕ Skipped 90 frames!  The application may be doing too much work on its main thread.
02-12 21:28:35.644    7764-7764/com.google.zxing.client.android D/CameraManager﹕ Calculated framing rect: Rect(150, 90 - 650, 390)

Invalid Value

I am getting Invalid Value in Custom search URL when i enter a URL with %s in it where the code should be written.

original URL:
https://www.sdtps.gov.ae/portal/page/portal/DTPS/Inquire_Service?_piref35_3502212_35_160057_160057.trxNo=(Barcode_Value_Should_Be_Here)&_piref35_3502212_35_160057_160057s.strutsAction=/tnt/trace.do

URL that i am putting is:
https://www.sdtps.gov.ae/portal/page/portal/DTPS/Inquire_Service?_piref35_3502212_35_160057_160057.trxNo=%s&_piref35_3502212_35_160057_160057s.strutsAction=/tnt/trace.do

I dont know why its telling me Invalid Value.
I believe the issue is that it taking the code %s with the rest of the url, in other words, its taking it as (%s&_piref35_3502212_35_160057_160057s.strutsAction=/tnt/trace.do) not only %s
how i can let it understand that this is seperated?

Remove TEST branches from main project

I'm currently attached to GoogleCode Zxing 2.2.0 repository and would like to adopt the latest Zxing version, but when i try to sync from git, i encounter an enormous amount of resources (mainly Pictures) on the TEST branches, that were not present on 2.2 version.

How can i checkout without getting all these unwanted branches?

android should not be compiled with java7

Android should not be compiled with java7,or the classes will not be recognized as by dalvik(bad magic number).

But the core is compiled with java7(if 1.5 or 1.6 is used,errors occured),so this version can not port to android.

MECARD / vCard encoding should delimit fields

Address / city / state / postal code and so on are supposed to be separated in MECARD and vCard, by comma and semicolon, respectively. The code right now doesn't break this down beyond an address field though, so isn't able to format accordingly.

Ideally the online encoder would have separate fields for address components. And, in Android, would retrieve address elements independently. However I am not sure Android breaks this out either, not via Intent.

Ported from https://code.google.com/p/zxing/issues/detail?id=1468

RuntimeException on getPreviewFpsRange

Hi,

on my android phone (Motorola Milestone 2 with CM10.2) I was getting crashes shortly after the barcode scanner started with the latest version from the Google Play.
I debugged the code a little bit and found the following:
getPreviewFpsRange in android/src/com/google/zxing/client/android/camera/CameraConfigurationManager.java (line 253) throws a RuntimeException because the camera parameters have preview-fps-range=10000, 30000 and so parseInt(" 30000") fails.
I don't know where this bug comes from (CM, Android, the guy who ported CM to the MS2) but I found out that the ROM I'm using is not the only ROM for the MS2 with this bug.
Although that exception is catched later on, the app force closes because of an IndexOutOfBoundsException in core/src/com/google/zxing/PlanarYUVLuminanceSource.java (line 73, offset > yuvData.length).
Long story short - the following patch fixes my problem:

--- CameraConfigurationManager1.java    2014-03-01 16:28:36.483774358 +0100
+++ CameraConfigurationManager2.java    2014-03-01 16:08:14.543834888 +0100
@@ -250,7 +250,11 @@
         Log.i(TAG, "No suitable FPS range?");
       } else {
         int[] currentFpsRange = new int[2];
-        parameters.getPreviewFpsRange(currentFpsRange);
+        try {
+           parameters.getPreviewFpsRange(currentFpsRange);
+        } catch (RuntimeException e) {
+           Log.i(TAG, "Error getting current PreviewFpsRange");
+        }
         if (!Arrays.equals(currentFpsRange, minimumSuitableFpsRange)) {
           Log.i(TAG, "Setting FPS range to " + Arrays.toString(minimumSuitableFpsRange));
           parameters.setPreviewFpsRange(minimumSuitableFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],

I don't know if other devices are affected but I would really appreciate it if this patch could be incorporated in your releases so I don't have to build my own :)

Invalid UPC_E leads to StringIndexOutOfBoundsException in ResultParser.parseResult

I get several stack like the following:
01-23 22:10:43.724: E/AndroidRuntime(28903): java.lang.StringIndexOutOfBoundsException: length=1; regionStart=1; regionLength=6
01-23 22:10:43.724: E/AndroidRuntime(28903): at java.lang.String.startEndAndLength(String.java:593)
01-23 22:10:43.724: E/AndroidRuntime(28903): at java.lang.String.getChars(String.java:902)
01-23 22:10:43.724: E/AndroidRuntime(28903): at com.google.zxing.oned.UPCEReader.convertUPCEtoUPCA(UPCEReader.java:124)
01-23 22:10:43.724: E/AndroidRuntime(28903): at com.google.zxing.client.result.ProductResultParser.parse(ProductResultParser.java:51)
01-23 22:10:43.724: E/AndroidRuntime(28903): at com.google.zxing.client.result.ProductResultParser.parse(ProductResultParser.java:28)
01-23 22:10:43.724: E/AndroidRuntime(28903): at com.google.zxing.client.result.ResultParser.parseResult(ResultParser.java:87)

While this stack comes from calling ResultParser.parseResult with an effectively invalid UPC_E (as it has only 1 char while I understand an UPC_E should have 8 chars), I also encountered an equivalent issue with a decoded UPC_E.

If it is expected to throy, I guess it should be handled at most in ResultParser.parseResult as this method should then try the next Parser.

Feature Request: Add the ParsedResult as part of IntentResult

This applies to android-integration. Currently, IntentIntegrator#parseActivityResult returns an IntentResult, which has a getContents() method returning a String.

In a lot of use cases, this String is not very helpful - it has to be parsed using the appropriate ResultParser anyway. This can of course be done as follows (taking the example of WiFi result):

IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
Result result = new Result(scanResult.getContents(), null, null, BarcodeFormat.QR_CODE);
WifiParsedResult parsedResult = (WifiParsedResult) WifiResultParser.parseResult(result);

However, this requires the addition of the core.jar as a dependency. It seems overkill to add a 500KB+ dependency just for parsing the result (particularly since the ability to parse the result is already present in the Barcode Scanner app itself).

I was able to avoid this by copying the following files into my project and making minor modifications to eliminate all parsers except the WifiResultParser:

  • BarcodeFormat.java
  • MathUtils.java
  • ParsedResult.java
  • ParsedResultType.java
  • Result.java
  • ResultType.java
  • ResultMetadataType.java
  • ResultParser.java
  • ResultPoint.java
  • TextParsedResult.java
  • WifiParsedResult.java
  • WifiResultParser.java

But since this is a frequent requirement, I propose to enhance the IntentResult API to also include the ParsedResult itself - exposed as a getParsedResult() method. I realize this is pretty simple thing to do and I would have made the changes and issued a pull request myself. However, this calls for a decision to be made that is best left to the project authors:

How to deal with exposing the ParsedResult and sub-classes to an Android app that uses IntentIntegrator?

  • Would you move these classes to the android-integration module? This would require the Barcode Scanner app to include android-integration as a dependency.
  • Would you rather move these files to a separate module and add this module as a dependency for both Barcode Scanner app and the android-integration module?

Ported from https://code.google.com/p/zxing/issues/detail?id=1832

Support for older Androids?

I have an older Android phone; version 2.2 (API version 8) and am unable to upgrade. According to the git log it seems that support for Android phones below version 10 was dropped in May last year and then support for anything below version 15 was dropped in September. Is there a reason why compatibility with older phone models couldn't be maintained?

How to locate a finder pattern that is not symmetric?

hanxincode
hanxincoderotated

Hello, I am being working on decodeing a kind of 2D barcode called "Hanxin Code" or "Chinese-Sensible Code". It's a type of 2D matrix code, very similar to QR Code. However, the finder pattern is not like the one in QR Code, it is not symmetric in both horizontal and vertical direction. How to locate the finder pattern when the code is rotated(for example, rotate 45 degrees) has puzzled me for a while. Is there anyone can help me? many thanks!!!

Kindle Fire HDX camera orientation inverted

Install BarcodeScanner-4.5.1.apk from the downloads section on a Kindle Fire HDX
Notice that the UI is properly oriented in landscape mode but the camera preview is inverted (up-side-down)

The UI should be properly oriented in landscape mode (as it is) but the camera preview should also be right-side-up.

This issue occurs whether the Kindle's "Auto-Rotate" feature is enabled or disabled.

device-2014-01-15-101638

Ported from https://code.google.com/p/zxing/issues/detail?id=1833

Need to handle onSurfaceChanged() in Barcode Scanner?

A user reported this exception:

java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@xxxxxxxx does not exist

In looking at possible causes I see that we may not be implementing onSurfaceChanged(), when it may be needed to handle rotations. This should cause the camera to re-init with a new surface. This may be one of those situations that never actually came up in practice but is still wrong.

Ported from https://code.google.com/p/zxing/issues/detail?id=1363

Implement Share Intent

Most of the time I want to forward a scanned URL (or some other data) somewhere so I can later check it out, usually with a laptop. This is currently not that easy:

  1. Scan a QR code URL
  2. Barcode Scanner shows buttons to open browser, share with email or SMS

Have a Share UI element which shows all the apps registered for sharing

A workaround currently is to open the scanned link in the browser and select "Share Page" which gives the option to share the link with a multitude of apps, including email and SMS.

However, this requires many steps and is slow and inconvenient. In some cases the browser gets redirected to a mobile site making it impossible to share the original URL. Sometimes the browser can't even open the URL, or proceeds to download the content.

Ported from https://code.google.com/p/zxing/issues/detail?id=1402

The compiler issues

in source code,you used the <> , you need version 1.7 to compiler the code, but the project is compiled in version 1.6

Scanning PDF417 crashes on android

Tested on latest version
zxing core-3.0.0-SNAPSHOT and Android app BBarcodeScanner-release.apk
on Nexus 5, Android 4.4.2

Scanning part of PDF417 barcode causes ArrayIndexOutOfBoundsException

steps to reproduce:
-install mentioned android app

-scanning entire image does not work but does not cause app to crash
-now try to scan with only bottom-half of the image (or less than half) in the crop area
-application crashes with ArrayIndexOutOfBoundsException

FATAL EXCEPTION: Thread-2883
Process: com.google.zxing.client.android, PID: 10770
java.lang.ArrayIndexOutOfBoundsException: length=24; index=24
at com.google.zxing.pdf417.decoder.PDF417ScanningDecoder.adjustBoundingBox(PDF417ScanningDecoder.java:146)
at com.google.zxing.pdf417.decoder.PDF417ScanningDecoder.decode(PDF417ScanningDecoder.java:71)
at com.google.zxing.pdf417.PDF417Reader.decode(PDF417Reader.java:61)
at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:171)
at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:58)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:110)

iOS vs Android

I noticed that the Android demo version is able to decode the attached datamatrix image.
capture

Why the iOS cannot do that? Will iOS sample be able to do this in the near future?

Scanning from web page - invalid or local URL

HI, Thanks for a brilliant product!
I've noticed in my development and testing, that certain return URLs don't work when scanning from a web page. Also, there's no indication that the URL is invalid, all that happens is that the barcode app never returns to the web browser.

If I use the complete URL, of either my full site (http://foo.com/add/{CODE}) or my dev machine (http://192.168.2.5/add/{CODE{), it works fine. However, if I use a 'partial' URL, like '/add/{CODE}' or '~/add/{CODE}, the app scans fine, but never returns to the web browser.

DATAMATRIX found as CODE_128

Hi!
with last cpp version of zxing (2.3.0) i have some problem with code type identity.
If i scan a big image with multiple barcode i find my datamatrix as CODE_128 (same of other type)
if i crop my datamatrix from image, zxing find it as DATA_MATRIX
anyone know a solution?

i tested it local on my pc and remotely on http://zxing.org/

big image (https://dl.dropboxusercontent.com/u/6140898/Temp/page007.jpg)
cropped dtmtrx(https://dl.dropboxusercontent.com/u/6140898/Temp/dtmtrx.png)

Aztec Reader not able to read smaller barcodes

I'm using the AS3 version of this to build a Flash Builder iPad (retina) app that scans Aztec Codes. The barcodes are quite dense and small (approx 200x200px), but when I go to scan them they aren't detected. I tried to move the camera as close to the barcode as possible, but the camera gets fuzzy to a point that it cannot read. If I print them out rather large - they read just fine. I have no control over the printed out barcodes...they need to be at 200x200px. Is there a way to ensure the smaller more dense Aztec codes are readable? For instance, perhaps enlarging the bitmap before it's sent off to be decoded? I'm testing with an iPad 3...perhaps the image quality isn't good enough. Maybe there's a way to set the scannable area (I know it looks for the barcode from the camera's center out).

Any help would be much appreciated. Thanks in advance.

PDF417 crashing occasionally.

When using 4.6.1 and earlier I get an occasional crash bug. It occurs with pretty much any PDF417 (on employee badges at a place I'm working), and can scan the same badge properly 90% of the time before crashing... so it doesn't seem like a problem with the barcode... I think the stack trace indicates that it's an issue with the bounding box it detects around the barcode, which makes sense as it often draws the green box around the wrong place (like on the mirror image of the correct place when held upside-down, or something like that)...

2014-02-20 10 36 05

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.