elixir-vision / zbar Goto Github PK
View Code? Open in Web Editor NEWBasic wrapper around a zbar barcode-scanning library
License: MIT License
Basic wrapper around a zbar barcode-scanning library
License: MIT License
It crashes if jpeg has "Premature end of JPEG file" and because of Task.async the caller app crashes too
13:43:01.184 [error] Task #PID<0.282.0> started from #PID<0.262.0> terminating
** (MatchError) no match of right hand side value: ["Premature"]
(zbar) lib/zbar.ex:116: anonymous fn/2 in Zbar.parse_symbol/1
(elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
(zbar) lib/zbar.ex:96: Zbar.format_result/1
(elixir) lib/task/supervised.ex:89: Task.Supervised.do_apply/2
(elixir) lib/task/supervised.ex:38: Task.Supervised.reply/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
When I run the basic usage like:
File.read("barcode.jpg") |> Zbar.scan()
I get an error like
** (FunctionClauseError) no function clause matching in IO.binwrite/2
(elixir 1.10.4) lib/io.ex:275: IO.binwrite(#PID<0.628.0>, {:ok, <<255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 0, 0, 72, 0, 72, 0, 0, 255, 225, 0, 76, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 2, 1, 18, 0, 3, 0, 0, 0, 1, ...>>})
(elixir 1.10.4) lib/file.ex:1417: File.open/3
(elixir 1.10.4) lib/file.ex:1455: File.open!/3
(zbar 0.2.1) lib/zbar.ex:38: Zbar.do_scan/2
(elixir 1.10.4) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
(elixir 1.10.4) lib/task/supervised.ex:35: Task.Supervised.reply/5
(stdlib 3.13.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Looking through the recent commits and hypothesizing based on the binwrite error, perhaps the structure that needs to be passed to IO.binwrite should be (pid, symbols)
instead of (pid, {:ok, symbols})
which is breaking the code in do_scan's return line 57 of zbar.ex?
Any thoughts appreciated! Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.