I use libzbar for decode QR code. It is work fine, but sometimes do not recognize QR code. I tried to understand and debug library.
I added definition for QR_DEBUG and DEBUG_SVG, after that i am analyzing images.
In function qr_reader_try_configuration after calculation affine projection from the three points we got fine result (undistorted_aff.png). But after upgrade the affine homography to a full homography we got wrong result (undistorted_hom.png).
I try understand function qr_hom_fit, but it is too difficult for me.
Example of QR code and debug images in attachment (also small fix for debug code).