Ask Your Question

Revision history [back]

objdetect module qrcode cant decode QR Code version 6

Hi, I'm running the example /opencv-4.0.0/sample/cpp/qrcode.cpp to detect and decode QR code. It can work with QR Code version 1~5, it seems like run QR code version 6 will cause memory corruption:

The qr code example from below link (Example of a QR code) https://whatis.techtarget.com/definition/QR-code-quick-response-code

I traced the code it seem like the following line will stop the decoding processing and cause the memory corruption /opencv-4.0.0/modules/objdetect/src/qrcode.cpp straight = Mat(Size(version_size, version_size), CV_8UC1, Scalar(0));

Can someone explain me how to solve it ? Thanks

======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ff3ee8737e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8213e)[0x7ff3ee87e13e] /lib/x86_64-linux-gnu/libc.so.6(+0x82c0a)[0x7ff3ee87ec0a] /lib/x86_64-linux-gnu/libc.so.6(posix_memalign+0x11d)[0x7ff3ee88371d] /usr/local/opencv4/lib/libopencv_core.so.4.0(_ZN2cv10fastMallocEm+0x39)[0x7ff3ef21572a] /usr/local/opencv4/lib/libopencv_core.so.4.0(+0x26853e)[0x7ff3ef3c653e] /usr/local/opencv4/lib/libopencv_core.so.4.0(_ZN2cv3Mat6createEiPKii+0x388)[0x7ff3ef3c75b6] /usr/local/opencv4/lib/libopencv_objdetect.so.4.0(_ZN2cv3Mat6createEiii+0xb2)[0x7ff3f089efa4] /usr/local/opencv4/lib/libopencv_objdetect.so.4.0(_ZN2cv3MatC2ENS_5Size_IiEEiRKNS_7Scalar_IdEE+0xe6)[0x7ff3f08f3b38] /usr/local/opencv4/lib/libopencv_objdetect.so.4.0(+0x8c6be)[0x7ff3f08fc6be] /usr/local/opencv4/lib/libopencv_objdetect.so.4.0(+0x8cb46)[0x7ff3f08fcb46] /usr/local/opencv4/lib/libopencv_objdetect.so.4.0(_ZN2cv14QRCodeDetector6decodeB5cxx11ERKNS_11_InputArrayES3_RKNS_12_OutputArrayE+0x411)[0x7ff3f08fd0d5] ./qrcode_example[0x40864f] ./qrcode_example(main+0x35c)[0x407457] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7ff3ee81c830] ./qrcode_example(_start+0x29)[0x406fc9]