Open powtac opened 8 years ago
Another image that can not be decoded. Should contains w_537241_108
but returns (bool)false
. :-(
Unfortunately you're right. How did you generate those qr codes ? (I'm not a developer on this project but just curious)
Those images where created by a PHP library, TCPDF
Just read http://www.tcpdf.org/doc/code/classTCPDF2DBarcode.html Which type did you use ? QRCODE : QRcode Low error correction QRCODE,L : QRcode Low error correction QRCODE,M : QRcode Medium error correction QRCODE,Q : QRcode Better error correction QRCODE,H : QR-CODE Best error correction
If you use a different one, is QrReader working ?
Default settings
It is not the creation lib that fails. The generated codes can be read via common smartphone readers!
Yeah I just wanted to check if the error correction could have been an issue for this reader. But I guess no..
What I discovered as well: when running the creation of the QR codes a different code for the same content is created. It seems like there are around 3 different versions of QR codes for the same text. I did a quick search and found a random part in the QR lib, so this is ok. BUT only one of the three QR codes fail with the detector!
Similar to #9, #12 and #13
i have a similar issue with the attached, i have created many QR codes with the same structure but different event id, but for some reason {"Event ID":"219619"} as the content just doesnt work, any ideas?
it was created using phpqrcode QRcode::png({"Event ID":"219619"},false,QR_ECLEVEL_L,35);
i have the same issue, so ,how did u solve it?😂
I have not solved it.
@powtac
this is my code and it works well , but it still can't recognize #9.
I don't know about you guys but I had to recognise Qr Codes that I generated. So after a qrcode generation I checked if I could read it with this library before printing it otherwise I would create a new one. But I guess most of you don't create the qr codes.. GL..
Actually I made the same kind of workaround.
Am 27.12.2016 um 16:49 schrieb jlemale notifications@github.com:
I don't know about you guys but I had to recognise Qr Codes that I generated. So after a qrcode generation I checked if I could read it with this library before printing it otherwise I would create a new one. But I guess most of you don't create the qr codes.. GL..
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
i don't create the qr codes, actually it's a part of my spider , so, i have to try to stretch it to different sizes to identify, that's too bad, but there's no other way.😂
To fix my issue like as your issue, I used imagecopyresampled
For example you can see my code:
$width = imagesx($imageResource);
$height = imagesy($imageResource);
for ($zoom = 100; $zoom >= 10; $zoom -= 10) {
$new_width = $width * $zoom / 100;
$new_height = $height * $zoom / 100;
$zoomResource = imagecreate(800, 350);
imagecopyresampled(
$zoomResource,
$imageResource,
0,
0,
0,
0,
$new_width,
$new_height,
$width,
$height
);
imagepng($zoomResource, $pathTempPng, 0, PNG_NO_FILTER);
imagedestroy($zoomResource);
try {
$qrcode = new QrReader($pathTempPng);
$numText = $qrcode->text();
if ($numText) {
echo ' FIND ' . $numText . ', ';
break;
}
} catch (\InvalidArgumentException $e) {
$numText = null;
}
echo '{' . $zoom . ' | ' . $numText . ' }, ';
}
The percentage of detected QRcodes increased from 10% to 90% for me.
I had the very same issue happen with me too. I used the hack @githubjeka provided but it ended up giving me 90% success rate too. So I just played around with numbers and found out that usage of zoom step = 5 will increase the success rate even further. I'm planning to add a fallback to https://github.com/dsiddharth2/php-zxing library too. It's a bit slower (around 10 times slower, actually) and also gives me about 90% success rate but on different images. I think I might add another fallback and just try and post my image to https://zxing.org unless it's against website's TOS (would be happy if anyone could enlighten me on the subject).
Both images contain the string w_7585681_2319
!
Version 1.0.2 is crashing for this image:
CRASH:
But works for this image:
OK:
Both images contain the string w_7585681_2319
!
This is the error message:
Fatal error: Uncaught InvalidArgumentException in /usr/vendors/php-qrcode-detector-decoder/Qrcode/Decoder/Version.php:121
Stack trace:
#0 /usr/vendors/php-qrcode-detector-decoder/Qrcode/Decoder/Version.php(112): Zxing\Qrcode\Decoder\Version::getVersionForNumber(0)
#1 /usr/vendors/php-qrcode-detector-decoder/Qrcode/Detector/Detector.php(84): Zxing\Qrcode\Decoder\Version::getProvisionalVersionForDimension(17)
#2 /usr/vendors/php-qrcode-detector-decoder/Qrcode/Detector/Detector.php(69): Zxing\Qrcode\Detector\Detector->processFinderPatternInfo(Object(Zxing\Qrcode\Detector\FinderPatternInfo))
#3 /usr/vendors/php-qrcode-detector-decoder/Qrcode/QRCodeReader.php(62): Zxing\Qrcode\Detector\Detector->detect(NULL)
#4 /usr/vendors/php-qrcode-detector-decoder/QrReader.php(80): Zxing\Qrcode\QRCodeReader->decode(Object(Zxing\BinaryBitmap))
#5 /www/htdocs in /usr/vendors/php-qrcode-detector-decoder/Qrcode/Decoder/Version.php on line 121
https://zxing.org/w/decode is able to decode both(!) images with the exact same result:
A diff shows that most of the dots are inverted on the other version:
This pull request seems to be related: https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/62 it suppresses the InvalidArgumentException exception. But still is not able to read the code.
To fix my issue like as your issue, I used composer require topthink/think-image
For example you can see my code:
...
$file_path = $dir_path . '/upload.png';
$image = Image::open($file_path);
$qrReaderPath = $dir_path . '/qrReader.png';
$image->thumb(150, 150)->save($qrReaderPath);
$qrcode = new QrReader($qrReaderPath);
if (!$qrcode->text()) {
return 'error';
}
return 'success';
@githubjeka can you please tell me in which file you added this custom code? is it part of QrReader.php? or you created a custom file, from where you call this code?
Thank you.
@shoaib-sme in my code. After the try
$qrcode = new QrReader($pathImage);
$numText = $qrcode->text();
if ($numText == null) {
// this
}
@githubjeka thank you sir for your quick reply. Cheers :)
To fix my issue like as your issue, I used
imagecopyresampled
For example you can see my code:$width = imagesx($imageResource); $height = imagesy($imageResource); for ($zoom = 100; $zoom >= 10; $zoom -= 10) { $new_width = $width * $zoom / 100; $new_height = $height * $zoom / 100; $zoomResource = imagecreate(800, 350); imagecopyresampled( $zoomResource, $imageResource, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); imagepng($zoomResource, $pathTempPng, 0, PNG_NO_FILTER); imagedestroy($zoomResource); try { $qrcode = new QrReader($pathTempPng); $numText = $qrcode->text(); if ($numText) { echo ' FIND ' . $numText . ', '; break; } } catch (\InvalidArgumentException $e) { $numText = null; } echo '{' . $zoom . ' | ' . $numText . ' }, '; }
The percentage of detected QRcodes increased from 10% to 90% for me.
Your solution saved my day! Thanks a bunch <3
This file can not be decoded with QrReader! it just returns
(bool)false
. But the text encoded in the QR Code isw_537244_40
.The correct result can be proved with the online Zxing.org encoder here. It returns: