makiuchi-d / gozxing

Port of ZXing (https://github.com/zxing/zxing) core to pure Go.
Other
549 stars 66 forks source link

NotFoundException: startSize = 1 #49

Closed ghost closed 1 year ago

ghost commented 2 years ago

IMG: https://i.imgur.com/UoRQWJE.jpg

I got this error from result, err := qrReader.Decode(bmp, nil)

makiuchi-d commented 2 years ago

The illustration on the bottom of the image seems to be noise for binarization.

Trim the image before binarization like this:

    img, _, _ := image.Decode(file)

    img = img.(interface {
        SubImage(image.Rectangle) image.Image
    }).SubImage(image.Rect(0, 0, 838, 1800))

    bmp, _ := gozxing.NewBinaryBitmapFromImage(img)