piderman314 / bardecoder

Detect and decode QR Codes, written in 100% Rust.
MIT License
275 stars 34 forks source link

Did Not Read QR #31

Closed Ricotan-Linus closed 4 years ago

Ricotan-Linus commented 4 years ago

Hey, I'm a Japanese stupid student who has a question. I tried reading this card QR. (This card is "aikatsu" which famous idol anime in Japan) QR but rust return thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: QRError { msg: "Format information corrupted" }', src/main.rs:9:31 . I don't know encoding and other QR technical specifications. Please tell me how to fix can read QR.

Ricotan-Linus commented 4 years ago

main.rs

    let img = image::open("QR.png").unwrap();
    let decoder = bardecoder::default_decoder();

    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

Cargo.toml


name = "XXX"
version = "0.1.0"
authors = ["Ricotan-Naboon <XXXX>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bardecoder = { version = "0.2.2", features = ["debug-images"] }
image = "0.22.5"```
piderman314 commented 4 years ago

Hi, this is because the image suffers from compression artifacts and a slight blurriness. My algorithm isn't capable enough to deal with it. I ran it through a simple sharpen filter (for example with the Photos editor in Windows); then it was able to be decoded.