GithubHelp home page GithubHelp logo

Unable to read QR cord. about zxing-cpp HOT 3 OPEN

glassechidna avatar glassechidna commented on May 30, 2024
Unable to read QR cord.

from zxing-cpp.

Comments (3)

axxel avatar axxel commented on May 30, 2024

TLDR: replace

return (int)(abs(firstConfirmedCenter->getX() - center->getX()) - abs(firstConfirmedCenter->getY()
- center->getY()))/2;
with return 0;

I started working on this new c++ port by @huycn and expected it to work fine here, since it is based on the up-to-date Java code. Interestingly, it failed to decode the QR-code just like you described. I debugged the code and found the problem. What I don't understand is, how the Java version would work here, since the problematic section is exactly the same code (as far as I can tell).

The issue is that a wrong finder pattern is detected, leading to the wrong dimension estimate, leading the invalid version number. That happens because the findRowSkip method, which is supposed to skip a few lines for detection speedup after two finder patterns have been found, results in a smaller count (here 2) for the two upper finder patterns compared to a wrongly detected pattern left of the image center (gets count 5). If the findRowSkip gets disabled (see above) the two upper patterns get a count of 12 which leads to the wrong one being removed instead of the correct upper-right one.

So no idea how the Java version deals with this but in my opinion, the findRowSkiprelated code is buggy (in upstream Java and both c++ ports).

from zxing-cpp.

TP-Nishiyama avatar TP-Nishiyama commented on May 30, 2024

Sorry about my late reply.

I intended to check the version data between JAVA version and C++ version.
But at first I check the logic searching finder patterns.

Thank you for an important information.

from zxing-cpp.

axxel avatar axxel commented on May 30, 2024

@huycn did have a look at how the JAVA version was able to detect the code and it turned out that you need to set the tryRotate flag. Then both upstream and his port successfully detect it. That fits with my above analysis, because then the 'wrong' pattern gets skipped at the same time as the two good ones are. I bet there is a good chance the C++ code in here behaves the same way if you set that flag. I'd still argue that the way this findRowSkip is used/implemented has room for improvement :).

from zxing-cpp.

Related Issues (20)

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.