Coder Social home page Coder Social logo

zxinglight's Issues

Port to a new backend? (was: segfault on OS X Mojave)

I'm getting a segfault with zxinglight every time it successfully parses a QR code.

Here's a test script that reproduces the crash:

#!/usr/bin/env python3

import sys
import PIL
import zxinglight

pil_frame = PIL.Image.open(sys.argv[1])
codes = zxinglight.read_codes(pil_frame)
print(codes)

and an image that triggers it:

code.png

and an image that does not trigger it.

table

$ ./crash.py code.png 
Segmentation fault: 11
$ ./crash.py table.png 
zxing::ReaderException: No code detected
[]
$ 

It seems that something is glitching on munging the zxing-cpp result back into python.

Here is the backtrace in full gory Apple detail:

Process:               Python [13433]
Path:                  /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.2 (3.7.2)
Code Type:             X86-64 (Native)
Parent Process:        bash [5795]
Responsible:           Python [13433]
User ID:               501

Date/Time:             2019-03-19 22:38:09.734 -0400
OS Version:            Mac OS X 10.14.3 (18D109)
Report Version:        12
Anonymous UUID:        5925085C-A291-3109-CDE7-A35156BBBB53

Sleep/Wake UUID:       F91C6048-F7D9-4384-992F-F4E9747AD453

Time Awake Since Boot: 39000 seconds
Time Since Wake:       6800 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [13433]

VM Regions Near 0x18:
--> 
    __TEXT                 00000001058f4000-00000001058f6000 [    8K] r-x/rwx SM=COW  /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   _zxinglight.cpython-37m-darwin.so	0x0000000106312fbf zxing::multi::GenericMultipleBarcodeReader::translateResultPoints(zxing::Ref<zxing::Result>, int, int) + 249
1   _zxinglight.cpython-37m-darwin.so	0x00000001063124ff zxing::multi::GenericMultipleBarcodeReader::doDecodeMultiple(zxing::Ref<zxing::BinaryBitmap>, zxing::DecodeHints, std::__1::vector<zxing::Ref<zxing::Result>, std::__1::allocator<zxing::Ref<zxing::Result> > >&, int, int, int) + 315
2   _zxinglight.cpython-37m-darwin.so	0x00000001063122d0 zxing::multi::GenericMultipleBarcodeReader::decodeMultiple(zxing::Ref<zxing::BinaryBitmap>, zxing::DecodeHints) + 116
3   _zxinglight.cpython-37m-darwin.so	0x00000001062ec5aa zxing_read_codes(_object*, _object*) + 842 (Counted.h:75)
4   org.python.python             	0x0000000105912533 _PyMethodDef_RawFastCallKeywords + 236
5   org.python.python             	0x0000000105911bd3 _PyCFunction_FastCallKeywords + 44
6   org.python.python             	0x00000001059a75f0 call_function + 636
7   org.python.python             	0x00000001059a02cf _PyEval_EvalFrameDefault + 7174
8   org.python.python             	0x00000001059a7ef7 _PyEval_EvalCodeWithName + 1835
9   org.python.python             	0x0000000105911b98 _PyFunction_FastCallKeywords + 225
10  org.python.python             	0x00000001059a7665 call_function + 753
11  org.python.python             	0x00000001059a0231 _PyEval_EvalFrameDefault + 7016
12  org.python.python             	0x00000001059a7ef7 _PyEval_EvalCodeWithName + 1835
13  org.python.python             	0x000000010599e626 PyEval_EvalCode + 51
14  org.python.python             	0x00000001059cd2a5 run_mod + 54
15  org.python.python             	0x00000001059cc2c0 PyRun_FileExFlags + 164
16  org.python.python             	0x00000001059cb97a PyRun_SimpleFileExFlags + 266
17  org.python.python             	0x00000001059e46a2 pymain_main + 5614
18  org.python.python             	0x00000001059e4ca4 _Py_UnixMain + 56
19  libdyld.dylib                 	0x00007fff5c2b0ed9 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000106363a70  rbx: 0x00007f85f4c304d0  rcx: 0x0000000000000000  rdx: 0x0000000040000000
  rdi: 0x00007f85f4c605c0  rsi: 0x000000005f4c605e  rbp: 0x00007ffeea30a7b0  rsp: 0x00007ffeea30a730
   r8: 0x000000005f4c605d   r9: 0x00007f85f4c00000  r10: 0x000000001fffffff  r11: 0x0000000000000001
  r12: 0x00007ffeea30a808  r13: 0x00007f85f4c41090  r14: 0x0000000000000000  r15: 0x00007f85f4c605c0
  rip: 0x0000000106312fbf  rfl: 0x0000000000010202  cr2: 0x0000000000000018
  
Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x1058f4000 -        0x1058f5fff +org.python.python (3.7.2 - 3.7.2) <6C779152-9270-3595-AC18-9BC057864DEE> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
       0x1058f8000 -        0x105a7eff7 +org.python.python (3.7.2, [c] 2001-2018 Python Software Foundation. - 3.7.2) <381588BD-EEDC-3DDD-8D65-0F7F54729B70> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Python
       0x105cd0000 -        0x105d4ea87  dyld (655.1) <3EBA447F-A546-366B-B302-8DC3B21A3E30> /usr/lib/dyld
       0x105eb6000 -        0x105eb7fff +_heapq.cpython-37m-darwin.so (0) <7F27633E-D5A9-3E71-9B65-5F276DB2F7E5> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so
       0x105ffc000 -        0x106000ffb +math.cpython-37m-darwin.so (0) <8B464989-661E-35CC-9B75-0E752410BBEE> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
       0x106006000 -        0x106009fff +_struct.cpython-37m-darwin.so (0) <D5C08DBC-5909-31B5-85D0-8FC2BFA85B14> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
       0x106010000 -        0x106061ffb +_imaging.cpython-37m-darwin.so (0) <3020104A-56A7-32CC-AFE0-140AAAA1AC8B> /usr/local/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-darwin.so
       0x106088000 -        0x1060d9ff3 +libjpeg.9.dylib (0) <8D5AF973-66A8-3C4F-A2EF-A58F2ECB58F1> /usr/local/lib/python3.7/site-packages/PIL/.dylibs/libjpeg.9.dylib
       0x1060e1000 -        0x106123fff +libopenjp2.2.1.0.dylib (0) <E4EA4ABF-A9A1-3615-ACB7-01951D6EEC5B> /usr/local/lib/python3.7/site-packages/PIL/.dylibs/libopenjp2.2.1.0.dylib
       0x10612d000 -        0x106148ff7 +libz.1.2.11.dylib (0) <8F57D771-E0DD-3DA4-8241-A90A4B0AE451> /usr/local/lib/python3.7/site-packages/PIL/.dylibs/libz.1.2.11.dylib
       0x10614c000 -        0x1061d8ff3 +libtiff.5.dylib (0) <5A576A29-DE0D-3A70-9D24-F9FFDCA7E14D> /usr/local/lib/python3.7/site-packages/PIL/.dylibs/libtiff.5.dylib
       0x1061ea000 -        0x10621afff +liblzma.5.dylib (0) <4E0649AF-77F8-3889-B300-B37ED7E6F40F> /usr/local/lib/python3.7/site-packages/PIL/.dylibs/liblzma.5.dylib
       0x1062eb000 -        0x106362ff7 +_zxinglight.cpython-37m-darwin.so (0) <E32EDD74-36E1-3051-AE41-D644788D27E5> /Users/USER/*/_zxinglight.cpython-37m-darwin.so
       0x10639a000 -        0x1063f4fff +libc++.1.dylib (0) <A61C65D9-842D-31E8-835E-1FF80A63777C> /usr/local/opt/llvm@6/lib/libc++.1.dylib
       0x10648a000 -        0x10648fff7 +array.cpython-37m-darwin.so (0) <1148BBD5-03F6-342D-AB54-ABA223CDBD9B> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/array.cpython-37m-darwin.so
       0x1064d6000 -        0x106503ffb +_decimal.cpython-37m-darwin.so (0) <7E9520C5-B012-30A8-9A93-368E23D68E60> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_decimal.cpython-37m-darwin.so
       0x106556000 -        0x106559fff +zlib.cpython-37m-darwin.so (0) <95AA4B1E-D850-3D25-977D-9096B45CE49F> /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/zlib.cpython-37m-darwin.so
    0x7fff2f028000 -     0x7fff2f475fef  com.apple.CoreFoundation (6.9 - 1562) <02A2C178-9FF6-385C-A9C5-7F4FC9D66311> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff59372000 -     0x7fff59373ff7  libDiagnosticMessagesClient.dylib (107) <15210AC0-61F9-3F9D-A159-A009F62EB537> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff59724000 -     0x7fff59725ffb  libSystem.B.dylib (1252.200.5) <C6201660-5E17-397D-BA21-C503420CD706> /usr/lib/libSystem.B.dylib
    0x7fff5997e000 -     0x7fff599d5ff7  libc++.1.dylib (400.9.4) <B260AC33-EB9A-30C6-8746-D011B3B02B08> /usr/lib/libc++.1.dylib
    0x7fff599d6000 -     0x7fff599ebfff  libc++abi.dylib (400.17) <446F4748-8A89-3D2E-AE1C-27EEBE93A8AB> /usr/lib/libc++abi.dylib
    0x7fff599ec000 -     0x7fff599ecff3  libcharset.1.dylib (51.200.6) <43F7E100-F5D1-36AB-A26E-CF94196A19C0> /usr/lib/libcharset.1.dylib
    0x7fff5a548000 -     0x7fff5a639ff7  libiconv.2.dylib (51.200.6) <9FB95807-7C62-32B7-A19F-946D7FB7CCA6> /usr/lib/libiconv.2.dylib
    0x7fff5a63a000 -     0x7fff5a89dffb  libicucore.A.dylib (62109.0.1) <FEB89BD3-79C4-3208-A754-7E6BC4D38548> /usr/lib/libicucore.A.dylib
    0x7fff5b1cc000 -     0x7fff5b952fe7  libobjc.A.dylib (750.1) <804715F4-F52D-34D0-8FEC-A25DC08513C3> /usr/lib/libobjc.A.dylib
    0x7fff5c0af000 -     0x7fff5c0c1ffb  libz.1.dylib (70.200.4) <15F7B40A-424C-33BB-BF2C-7E8195128B78> /usr/lib/libz.1.dylib
    0x7fff5c132000 -     0x7fff5c136ff3  libcache.dylib (81) <704331AC-E43D-343A-8C24-39201142AF27> /usr/lib/system/libcache.dylib
    0x7fff5c137000 -     0x7fff5c141ff3  libcommonCrypto.dylib (60118.220.1) <9C865644-EE9A-3662-AB77-7C8A5E561784> /usr/lib/system/libcommonCrypto.dylib
    0x7fff5c142000 -     0x7fff5c149fff  libcompiler_rt.dylib (63.4) <817772E3-E836-3FFD-A39B-BDCD1C357221> /usr/lib/system/libcompiler_rt.dylib
    0x7fff5c14a000 -     0x7fff5c153ff3  libcopyfile.dylib (146.200.3) <5C5C4F35-DAB7-3CF1-940F-F47192AB8289> /usr/lib/system/libcopyfile.dylib
    0x7fff5c154000 -     0x7fff5c1d8fdf  libcorecrypto.dylib (602.230.1) <C78D1A87-5543-3561-BEB4-3B480BA94ECB> /usr/lib/system/libcorecrypto.dylib
    0x7fff5c25f000 -     0x7fff5c299ff7  libdispatch.dylib (1008.220.2) <2FDB1401-5119-3DF0-91F5-F4E105F00CD7> /usr/lib/system/libdispatch.dylib
    0x7fff5c29a000 -     0x7fff5c2c9ff3  libdyld.dylib (655.1) <90C801E7-5D05-37A8-810C-B58E8C53953A> /usr/lib/system/libdyld.dylib
    0x7fff5c2ca000 -     0x7fff5c2caffb  libkeymgr.dylib (30) <A4EFD9A4-2EF3-3E18-B325-F527E3821939> /usr/lib/system/libkeymgr.dylib
    0x7fff5c2d8000 -     0x7fff5c2d8ff7  liblaunch.dylib (1336.240.2) <D5F0014D-CF46-3B04-9DE0-A1466DA14A2C> /usr/lib/system/liblaunch.dylib
    0x7fff5c2d9000 -     0x7fff5c2defff  libmacho.dylib (921) <6ADB99F3-D142-3A0A-B3CE-031354766ACC> /usr/lib/system/libmacho.dylib
    0x7fff5c2df000 -     0x7fff5c2e1ffb  libquarantine.dylib (86.220.1) <58524FD7-63C5-38E0-9D90-845A79551C14> /usr/lib/system/libquarantine.dylib
    0x7fff5c2e2000 -     0x7fff5c2e3ff3  libremovefile.dylib (45.200.2) <BA53CA8A-9974-3A43-9265-B110B1AE470F> /usr/lib/system/libremovefile.dylib
    0x7fff5c2e4000 -     0x7fff5c2fbff3  libsystem_asl.dylib (356.200.4) <33C62769-1242-3BC1-9459-13CBCDECC7FE> /usr/lib/system/libsystem_asl.dylib
    0x7fff5c2fc000 -     0x7fff5c2fcfff  libsystem_blocks.dylib (73) <152EDADF-7D94-35F2-89B7-E66DCD945BBA> /usr/lib/system/libsystem_blocks.dylib
    0x7fff5c2fd000 -     0x7fff5c385fff  libsystem_c.dylib (1272.200.26) <D6C701A2-9F17-308D-B6AC-9E17EF31B7DF> /usr/lib/system/libsystem_c.dylib
    0x7fff5c386000 -     0x7fff5c389ff7  libsystem_configuration.dylib (963.200.27) <94898525-ECC8-3CC9-B312-CBEAAC305E32> /usr/lib/system/libsystem_configuration.dylib
    0x7fff5c38a000 -     0x7fff5c38dff7  libsystem_coreservices.dylib (66) <10818C17-70E1-328E-A3E3-C3EB81AEC590> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff5c38e000 -     0x7fff5c394ffb  libsystem_darwin.dylib (1272.200.26) <07468CF7-982F-37C4-83D0-D5E602A683AA> /usr/lib/system/libsystem_darwin.dylib
    0x7fff5c395000 -     0x7fff5c39bff7  libsystem_dnssd.dylib (878.240.1) <5FEA5E1E-E80F-3616-AD33-8E936D61F31A> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff5c39c000 -     0x7fff5c3e8ff3  libsystem_info.dylib (517.200.9) <54B65F21-2E93-3579-9B72-6637A03245D9> /usr/lib/system/libsystem_info.dylib
    0x7fff5c3e9000 -     0x7fff5c411ff7  libsystem_kernel.dylib (4903.241.1) <CA10BC3A-5B09-32CE-B74F-BAD01755AA37> /usr/lib/system/libsystem_kernel.dylib
    0x7fff5c412000 -     0x7fff5c45dff7  libsystem_m.dylib (3158.200.7) <AF25F8E8-194C-314F-A2D3-A424853EE796> /usr/lib/system/libsystem_m.dylib
    0x7fff5c45e000 -     0x7fff5c482ff7  libsystem_malloc.dylib (166.220.1) <4777DC06-F9C6-356E-82AB-86A1C6D62F3A> /usr/lib/system/libsystem_malloc.dylib
    0x7fff5c483000 -     0x7fff5c48eff3  libsystem_networkextension.dylib (767.240.1) <4DB0D4A2-83E7-3638-AAA0-39CECD5C25F8> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff5c48f000 -     0x7fff5c496fff  libsystem_notify.dylib (172.200.21) <65B3061D-41D7-3485-B217-A861E05AD50B> /usr/lib/system/libsystem_notify.dylib
    0x7fff5c497000 -     0x7fff5c4a0fef  libsystem_platform.dylib (177.200.16) <83DED753-51EC-3B8C-A98D-883A5184086B> /usr/lib/system/libsystem_platform.dylib
    0x7fff5c4a1000 -     0x7fff5c4abfff  libsystem_pthread.dylib (330.230.1) <80CC5992-823E-327E-BB6E-9D4568B84161> /usr/lib/system/libsystem_pthread.dylib
    0x7fff5c4ac000 -     0x7fff5c4afff7  libsystem_sandbox.dylib (851.230.3) <D6469A17-C13C-3538-A300-D6517BB7F249> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff5c4b0000 -     0x7fff5c4b2ff3  libsystem_secinit.dylib (30.220.1) <5964B6D2-19D4-3CF9-BDBC-4EB1D42348F1> /usr/lib/system/libsystem_secinit.dylib
    0x7fff5c4b3000 -     0x7fff5c4baff7  libsystem_symptoms.dylib (820.237.2) <487E1794-4C6E-3B1B-9C55-95B1A5FF9B90> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff5c4bb000 -     0x7fff5c4d0ff7  libsystem_trace.dylib (906.220.1) <4D4BA88A-FA32-379D-8860-33838723B35F> /usr/lib/system/libsystem_trace.dylib
    0x7fff5c4d2000 -     0x7fff5c4d7ffb  libunwind.dylib (35.4) <EF1A77FD-A86B-39F5-ABEA-6100AB23583A> /usr/lib/system/libunwind.dylib
    0x7fff5c4d8000 -     0x7fff5c508fff  libxpc.dylib (1336.240.2) <EE0CDA53-6FF9-3B4E-A571-335A5FF6B6F4> /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 18782
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=241.0M resident=0K(0%) swapped_out_or_unallocated=241.0M(100%)
Writable regions: Total=64.6M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=64.6M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        2 
MALLOC                            43.5M       12 
MALLOC guard page                   16K        5 
MALLOC_LARGE (reserved)            512K        4         reserved VM address space (unallocated)
STACK GUARD                          4K        2 
Stack                             16.0M        2 
VM_ALLOCATE                       4352K       12 
__DATA                            4456K       65 
__LINKEDIT                       217.2M       19 
__TEXT                            23.8M       61 
__UNICODE                          564K        2 
shared memory                       12K        4 
===========                     =======  ======= 
TOTAL                            310.2M      178 
TOTAL, minus reserved VM space   309.8M      178 

Model: MacBookPro14,1, BootROM 184.0.0.0.0, 2 processors, Intel Core i5, 2,3 GHz, 8 GB, SMC 2.43f6
Graphics: Intel Iris Plus Graphics 640, Intel Iris Plus Graphics 640, Built-In
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80AD, 0x483943434E4E4E424A54414C41522D4E5644
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80AD, 0x483943434E4E4E424A54414C41522D4E5644
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x170), Broadcom BCM43xx 1.0 (7.77.61.1 AirPortDriverBrcmNIC-1305.2)
Bluetooth: Version 6.0.10f1, 3 services, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.0 Bus
Thunderbolt Bus: MacBook Pro, Apple Inc., 39.2

It's something specific to zxinglight because the zxing binary can handle this image fine:

$ ls -l `which zxing`
lrwxr-xr-x  1 kousu  admin  35 19 mar 22:11 /usr/local/bin/zxing -> ../Cellar/zxing-cpp/2.3.0/bin/zxing
$ zxing --more code.png 
  Format: QR_CODE
  Point[0]: 257.5 621
  Point[1]: 204 51.5
  Point[2]: 800 45
  Point[3]: 761.5 566
{2-3}LZ7BDOso7qsr7cs0MV5NDQPYxEVeCMxsupw5zFGQf4GBn3u+nOcRjmKZT6UZO886fmqy/i6NTuUlc+otO6ZlpvXEVc0Dfvw1G+2s/zKElUi552dZv8bDvP88q89DmylL4bu6mtzTUKaDr+GI4WgoTZ
anaesthetic-mac:qrdecode kousu$ 

Furthermore, this happens for me even with your tests. (yay tests!)

$ git clone [email protected]:lubo/zxinglight.git
$ cd zxinglight
$ sudo pip install nose  # to get nosetests, which I didn't have
$ make
pip install -e .[test]
Obtaining file:///Users/kousu/src/zxinglight
Requirement already satisfied: Pillow in /usr/local/lib/python3.7/site-packages (from zxinglight==1.0.1) (5.4.1)
Requirement already satisfied: flake8 in /usr/local/lib/python3.7/site-packages (from zxinglight==1.0.1) (3.5.0)
Requirement already satisfied: nose in /usr/local/lib/python3.7/site-packages (from zxinglight==1.0.1) (1.3.7)
Collecting pep8-naming (from zxinglight==1.0.1)
  Downloading https://files.pythonhosted.org/packages/37/e0/9548dbccda34614865846bdf452e390f2f829e7608e74965dcf0b9433583/pep8_naming-0.8.2-py2.py3-none-any.whl
Requirement already satisfied: pyflakes<1.7.0,>=1.5.0 in /usr/local/lib/python3.7/site-packages (from flake8->zxinglight==1.0.1) (1.6.0)
Requirement already satisfied: pycodestyle<2.4.0,>=2.0.0 in /usr/local/lib/python3.7/site-packages (from flake8->zxinglight==1.0.1) (2.3.1)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /Users/kousu/Library/Python/3.7/lib/python/site-packages (from flake8->zxinglight==1.0.1) (0.6.1)
Collecting flake8-polyfill<2,>=1.0.2 (from pep8-naming->zxinglight==1.0.1)
  Downloading https://files.pythonhosted.org/packages/86/b5/a43fed6fd0193585d17d6faa7b85317d4461f694aaed546098c69f856579/flake8_polyfill-1.0.2-py2.py3-none-any.whl
Installing collected packages: flake8-polyfill, pep8-naming, zxinglight
  Found existing installation: zxinglight 1.0.1
    Uninstalling zxinglight-1.0.1:
      Successfully uninstalled zxinglight-1.0.1
  Running setup.py develop for zxinglight
Successfully installed flake8-polyfill-1.0.2 pep8-naming-0.8.2 zxinglight
flake8
/usr/local/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
nosetests tests/
.make: *** [test] Segmentation fault: 11

Add possibility to get barcode-details in python

Hi!

It would be really helpfully to make the details of the barcodes (raw, type, points) as provided by ZXing-cpp accessible to the python-user. Use-cases are f.e. overlay of a tooltip wiht barcode-data and meta-information in a scanned document.

Possible solution without breaking running projects would be another function for getting all barcodes with details.

Cheers

Jörn

Structured Append

QR codes have a paging feature that no one knows about. I've implemented them for cozmo/jsQR#132 and the new zxing has partial support for them. qrencode -S will use it, and it's really useful! zxinglight should support it.

I could not use the library

lubo first of all I love your project, but I have had problems when it comes to installing and using the library

$ python3
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from . import read_codes, BarcodeType
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'read_codes'
>>> from zxinglight import read_codes, BarcodeType
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zxinglight/__init__.py", line 6, in <module>
    from ._zxinglight import zxing_read_codes
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zxinglight/_zxinglight.cpython-36m-darwin.so, 2): Symbol not found: _libiconv
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zxinglight/_zxinglight.cpython-36m-darwin.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zxinglight/_zxinglight.cpython-36m-darwin.so

I appreciate an early help. regards

I can not detect pdf417

Hi lubo, I am using your library to detect pdf417 barcode, but it does not detect it.
zxing::ReaderException: No code detected
this is the code I am using

import numpy as np
import cv2
from PIL import Image
from zxinglight import read_codes, BarcodeType

cap = cv2.VideoCapture(0)

while (True):
	ret, frame = cap.read()
	gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
	cv2.imshow('frame', gray)
	pil = Image.fromarray(gray)
	width, height = pil.size
	raw = pil.tobytes()
	code = read_codes(pil, barcode_type=BarcodeType.NONE)
	for x in code:
		print(x)

	if cv2.waitKey(1) & 0xFF == ord('q'):
		break

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.