tuotoo / qrcode Goto Github PK
View Code? Open in Web Editor NEWqrcode scanner ( decoder ) by golang 二维码扫描识别
License: GNU General Public License v3.0
qrcode scanner ( decoder ) by golang 二维码扫描识别
License: GNU General Public License v3.0
2018/09/21 19:35:58 /code/uploadfile/src/github.com/tuotoo/qrcode/qrcode.go:264: /code/uploadfile/src/github.com/tuotoo/qrcode/qrcode.go 698 open groups/groups0.png: no such file or directory
使用其他网站在线解码正常.
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/tuotoo/qrcode.(*Matrix).At(...)
F:/golang/get/src/github.com/tuotoo/qrcode/qrcode.go:51
github.com/tuotoo/qrcode.DecodeImg(0x7df5a0, 0xc04203a180, 0x0, 0x0, 0x0)
F:/golang/get/src/github.com/tuotoo/qrcode/qrcode.go:859 +0x18c0
github.com/tuotoo/qrcode.Decode(0x7dafe0, 0xc042fb9600, 0x63079e, 0x3, 0x630558)
F:/golang/get/src/github.com/tuotoo/qrcode/qrcode.go:872 +0xdf
main.main()
F:/golang/my/src/qr/mian.go:114 +0x69d
2019/10/13 08:01:25 [Recovery] 2019/10/13 - 08:01:25 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:82 (0x442480)
panicmem: panic(memoryError)
/usr/local/go/src/runtime/signal_unix.go:390 (0x4422af)
sigpanic: panicmem()
runtime error: invalid memory address or nil pointer dereference
http://sm168.com/uploadfile/2018/1120/20181120043843357.png
我想识别支付宝图片里面的二维码, 都无法识别, 只能用来识别只有二维码的情况, 带点边框就不行了
qr image url:https://s1.ax1x.com/2018/01/25/p7LQa9.jpg
goroutine 1 [running]:
github.com/tuotoo/qrcode.(*Matrix).FormatInfo(0xc0422a2000, 0x0, 0x32)
E:/Work/GoLib/src/github.com/tuotoo/qrcode/qrcode.go:78 +0x232
github.com/tuotoo/qrcode.Decode(0x3514ff0, 0xc042156140, 0xc042156140, 0x3514ff0, 0xc042156140)
E:/Work/GoLib/src/github.com/tuotoo/qrcode/qrcode.go:879 +0x18b
main.InitSSNode(0x765920, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
E:/Work/GoWorkSpace/src/Orefa/ss/nutgeek/main.go:94 +0x115
main.main()
E:/Work/GoWorkSpace/src/Orefa/ss/nutgeek/main.go:83 +0x52
有中文的二维码图片直接报错
☁ run go run .
2020/04/09 21:31:56 not found error correction level and mask
使用其他网站在线解码正常.
panic: not found errorcorrectionlevel and mask
goroutine 1 [running]:
github.com/tuotoo/qrcode.(*Matrix).FormatInfo(0xc04209c370, 0x0, 0x1a)
F:/golang/get/src/github.com/tuotoo/qrcode/qrcode.go:78 +0x232
github.com/tuotoo/qrcode.Decode(0x7dafe0, 0xc042a18500, 0x63067e, 0x3, 0x630438)
F:/golang/get/src/github.com/tuotoo/qrcode/qrcode.go:879 +0x19f
main.main()
F:/golang/my/src/qr/mian.go:114 +0x676
没几个能识别的
1.qrcode12.png,qrcode2.png,qrcode3.png 解码失败;
2.微信二维码解码失败;
3.json文本会发生解码失败。
无法读取 jfif 文件
image.Decode 原生就不支持这种文件格式,这个有办法支持一下么
https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html
利用这个生成的小程序,识别不了
not found error correction level and mask
func decode(writer http.ResponseWriter, request *http.Request) {
imgUrl := request.URL.Query().Get("url")
resp, err := http.Get(imgUrl)
if err != nil {
http.Error(writer, err.Error(), http.StatusInternalServerError)
return
}
defer resp.Body.Close()
//i, _, err := image.Decode(resp.Body)
//if err != nil {
// log.Fatal(err)
//}
//fmt.Println(i.Bounds())
qrMatrix, err := qrcode.Decode(request.Body)
if err != nil {
http.Error(writer, err.Error(), http.StatusInternalServerError)
return
}
writer.Write([]byte(qrMatrix.Content))
}
This return an error: image: unknown format
When the white in the image is adjusted to be transparent, it can not be resolved
github.com/tuotoo/qrcode.NewPositionDetectionPattern(0xc04209b8b8, 0x0, 0x0, 0x0)
E:/Work/GoLib/src/github.com/tuotoo/qrcode/qrcode.go:175 +0x598
github.com/tuotoo/qrcode.DecodeImg(0x5b3e80, 0xc0420460c0, 0x0, 0x0, 0x0)
Hello, Thanks for the work!
I'm here to leave an example of a read using an image.RGBA
in memory, The following is the code of Image
for bytes.Reader
, reading directly from memory:
package main
import (
"bytes"
"fmt"
"image"
"image/png"
"github.com/kbinani/screenshot"
"github.com/tuotoo/qrcode"
)
func main() {
img, err := screenshot.CaptureRect(image.Rect(0, 0, 40, 40))
if err != nil {
panic(err)
}
buff := new(bytes.Buffer)
// encode image to buffer
err = png.Encode(buff, img)
if err != nil {
fmt.Println("failed to create buffer", err)
}
// convert buffer to reader
reader := bytes.NewReader(buff.Bytes())
qrmatrix, err := qrcode.Decode(reader)
if err != nil {
fmt.Println(err.Error())
return
}
fmt.Println("contend:")
fmt.Println(qrmatrix.Content)
}
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.