I am writing something that needs to verify the practical readability of qr codes which has been painted over.

First thing that comes to mind is to apply Gaussian blur on the image and check if it is readable. Then I could get a “readability score” by doing binary search between blur strengths range [0, n].

I also may do the same with noise, not sure if I should.

Would appreciate if somebody with more knowledge of QR codes help me

    • yogurtwrong@lemmy.worldOP
      link
      fedilink
      arrow-up
      0
      ·
      13 hours ago

      I just did.

      I will block (or discourage) writing on timing bits and stuff and limit writes on format bits.

      I am also in the process of manually calculating a QR code and drawing it on paper to understand the format better. (pretty fun activity ngl)

      Btw the thing I am building is an app that would help manually create qr code art.

      RGB is not feasible because the aim of the app is to be a monochrome first QR art creator.

      • cecilkorik@lemmy.ca
        link
        fedilink
        English
        arrow-up
        0
        ·
        6 hours ago

        The art may be monochrome but the readers interpreting the QR (the part you are supposed to be testing) are almost certainly RGB. If you are not testing from the point of view of a camera reading the image, you are leaving a blind spot, no pun intended, and are not really testing properly.

      • MonkderVierte@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        13 hours ago

        Great! Knock yourself out!

        RGB is not feasible because the aim of the app is to be a monochrome first QR art creator.

        Ah, right. Not shades of black either then.

  • benjirenji@slrpnk.net
    link
    fedilink
    arrow-up
    0
    ·
    15 hours ago

    Without knowing the usecase too much you need vary the following variables:

    • contrast (simulate colors and different lighting conditions)
    • shadows
    • blur
    • viewing angles (perspective distortion)
    • occlusions
    • different QR code versions (v1, v5, v20 etc.)
    • noise (introduced by camera gain)
    • camera lens distortion

    Maybe not all is relevant to your usecase, but these are the main challenges.

  • kevincox@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    15 hours ago

    I doubt Gaussian blur is an accurate model of real-world situations.

    At the end of the day if you are worried about the codes being painted over print a few out and paint over them. Then scan with a variety of scanners.

    If I had to come up with some more digital tests I would guess that a few of these are more representative of real-world situations:

    1. Lower contrast. For example lighten or darken the whole code. This would simulate things like scanning in low light or with glare.
    2. Block out sections of the code. This will test error correction levels and simulate partial damage or pockets of extreme glare.
    3. Skew the code in various ways. This simulates the perspective shift of people scanning the code from an angle.

    Ideally combine them in a bunch of scenarios then try to scan with a variety of scanner implementations.

  • Starfighter@discuss.tchncs.de
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    16 hours ago

    QR codes come with (differing levels of) error correction. You could decode it and take the amount of corrected errors as a score.

    I don’t know what unit/chunk of data the error correction works on but you could alternatively dive a bit into information theory and measure how close any of the chunks are to an uncorrectable error and use that as a score.

    One benefit of this approach would be that its a single scan and done vs searching n permutations of the same code.