Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Having trouble scanning some PDF417 barcodes #532

Open
stephen-gobin opened this issue Aug 22, 2017 · 13 comments
Open

Having trouble scanning some PDF417 barcodes #532

stephen-gobin opened this issue Aug 22, 2017 · 13 comments

Comments

@stephen-gobin
Copy link

Expected Behaviour

To scan all the examples of PDF417 found here

https://www.activebarcode.com/codes/pdf417.html

as well as large barcodes found on ID cards

Actual Behaviour

The largest code with ECL5 will not scan nor will my MD DL card

Reproduce Scenario (including but not limited to)

I printed the page out, cut out the individual codes and scanned them one by one. I also confirmed the largest scanned with a downloaded app.

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 6.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Lenovo TB3-730F

Cordova CLI version and cordova platform version

cordova --version

7.0.1

cordova platforms

android 6.2.3

Plugin version

6.0.8

Sample Code that illustrates the problem

I used the sample code provided

Logs taken while reproducing problem

@andersborgabiro
Copy link

andersborgabiro commented Aug 26, 2017

This is probably due to the camera not having pixels enough in the preview mode to be able to see each pixel distrinctly. I've had that problem with PDF417 and I rendered maps of what the barcode algorithm in Zxing sees, and I concluded:

  • Preview pictures are thresholded, so the algorithm only sees a 1-bit-per-pixel bitmap
  • I easily came very close to or even under the preview resolution, that is much lower than the full camera resolution
    For the above to work well, there needs to be roughly 3 steady pixels per barcode module. You can easily calculate if you are close to that.

An improvement to Zxing would be to use grayscale maps instead, as well as take full-resolution photos, but as noted, that's not how Zxing works.

I actually lost a consulting assignment due to smartphones not being up to the task of reading such extreme PDF417 codes. In other words, not my fault, but it became my fault. In my case I even had to implement PDF417 Compact in Zxing, that is even hairier to scan, as there's no end marker to lock on to.

@cristianchaparroa
Copy link

Hi guys apparently I've the same issue, with Android (LG Xcam) I read the PDF417 image (my country identification) and I get the long text decode, but with IOS (Iphone 7) I get just the first 10 chars, what can I do for decode the hole barcode?

@andersborgabiro
Copy link

Before concluding it's an error in the actual decoding, rather than a resolution problem: Have you tried printing out the barcode larger so that there's a greater chance the camera can focus? The iPhone 7 might have a lower resolution video preview than the LG. PDF417 tends to be printed very small.

@cristianchaparroa
Copy link

cristianchaparroa commented Sep 30, 2017

@andersborgabiro well, I can't print the barcode because is my identification and I don't have the image source, so I took a photograph and I printed it bigger, but I can't scan nothing, so is there a way to modify the resolution video preview over IPhone 7 to check your suggestion?

@andersborgabiro
Copy link

Fully understandable.

Selection of video preview resolution is handled by Zxing, and there might be a way to change it, but requires making changes to the plugin.

This is about Xamarin, but note the setting: https://stackoverflow.com/questions/42657211/how-to-scan-drivers-license-pdf417-using-xamarin-forms-zxing-on-ios-10-2

@jasj
Copy link

jasj commented Oct 31, 2017

iphone have problems reading binary pdf417

for example bytes upper than 127 and lowr to 198 (utf 8 encode) produce and control signal that end the code. This is not an resolution problem as a mention @andresborgabiro due pdf417 with text has no prob'ems

19_0_53_152_55_63_167_32_149_156_114_180_66_157_79_141_79_116_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_96_75_246_69_75_210_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_127_181_74_131_32_155_73_98_119_75_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_222_35_153_233_6_208_54_225_53_237_48_21_3_52_148_48_59_147_18_160_209_51_224_3_208_49_233_2_2_48_103_241_255_143_19_149_44_171_183_156_140_162_149_71_171_118_152_117_42_60_157_252_108_236_84_85_157_56_163_106_173_95_64_77_119_54_119_153_249_147_202_65_167_114_163_67_143_65_162_187_166_113_47_156_186_52_176_10_124_98_64_152_64_182_115_171_191_129_144_29_156_219_7_73_33_187_78_165_108_255_45_16_186_106_221_187_12_80_149_37_236_95_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_50_32_160_119_94_108_146_32_95_188_97_139_83_146_166_152_186_159_83_10_120_129_229_144_229_67_97_103_111_81_66_171_82_64_66_112_198_107_139_229_143_207_86_92_120_81_115_98_69_163_187_162_156_57_121_176_205_160_4_118_79_116_179_99_85_125_163_188_157_172_193_133_96_18_91_208_129_86_69_100_127_50_112_188_126_29_251_20_84_243_37_239_93_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_160_0_15_147_18_160_209_51_224_3_208_0_223_0_39_48_4_

@jasj
Copy link

jasj commented Oct 31, 2017

to fix it is necesary tonchange the outcode from unicode or utf8 to a binnary array, due jsndont handle binary could be an int array

@cristianchaparroa
Copy link

cristianchaparroa commented Nov 1, 2017

@jasj if I understand with Iphone is not possible read complex pdf417 barcodes? I did a whole test with native application with swift and it read's just a little string no more, I can't get the whole string that I can read with Android phones.

@jasj
Copy link

jasj commented Nov 1, 2017 via email

@cristianchaparroa
Copy link

@jasj So, is there any option to read it?

@jasj
Copy link

jasj commented Nov 1, 2017 via email

@bpetty-formfast
Copy link

I have noticed PDF417 problems as well when trying to encode less than 4 characters. For what ever reason it gets them wrong all of the time, so I had to change my demo to ensure that I was scanning a code of at least 4 characters. We later switched to QR, partly due to this problem and because it seemed like it scanned faster on some platforms.

@andersborgabiro
Copy link

PDF417 is very sensitive to misalignment etc, so that was a good decision anyway. QR code is much more robust, by design.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

6 participants