Invert pixels - zxing

前端 未结 1 890
暗喜
暗喜 2020-12-18 13:18

I\'m using a zxing library in my iOS project. It\'s a library for reading and creating QR Codes.

From my researching and browsing around the web the process of decod

相关标签:
1条回答
  • 2020-12-18 13:48

    You don't want to print the values as characters because they aren't ASCII. Print them as unsigneds:

    printf(" %u", ...);
    

    You can simplify the loop to simply

    result[i] = static_cast<unsigned char>(255 - result[i]);
    

    The other conversions are normal integral promotion.

    And you should note that ZXing uses some asymmetric heuristics when identifying codes. If you don't have a guard region surrounding the code that is, in this case, black (since the guard region is supposed to be white), it may fail to identify the code.

    0 讨论(0)
提交回复
热议问题