System information (version)
- OpenCV => 3.4
- Operating System / Platform => ubuntu 22.04
- Compiler => gcc11
Detailed description
A part of timing Pattern is broken. (Same as left-bottom parts).
Timing pattern is used to determine version. So QRCodeDetector cannot decode it.
Left image is expected output. Right image is current output.

Reason
Version information and timing pattern is overlapped when ( i== 6 or j == 6).
https://github.com/opencv/opencv/blob/3.4/modules/objdetect/src/qrcode_encoder.cpp#L976
if (version_level >= 7)
{
for (int i = 0; i <= 6; i++) // (1) Version information
{
for (int j = version_size - 11; j <= version_size - 8; j++)
{
original.at<uint8_t>(i, j) = INVALID_REGION_VALUE;
original.at<uint8_t>(j, i) = INVALID_REGION_VALUE;
}
}
}
for (int i = 0; i < version_size; i++) // (2) Timing pattern
{
for (int j = 0; j < version_size; j++)
{
if (original.at<uint8_t>(i, j) == INVALID_REGION_VALUE)
{
continue;
}
if ((i == 6 || j == 6))
{
original.at<uint8_t>(i, j) = INVALID_REGION_VALUE;
if (!((i == 6) && (j - 7) % 2 == 0) &&
!((j == 6) && ((i - 7) % 2 == 0)))
{
masked_data.at<uint8_t>(i, j) = 0;
}
}
Steps to reproduce
expect_msg = "OpenCV";
Mat qrimg;
QRCodeEncoder::Params params;
params.version = 7;
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
qrcode_enc->encode(expect_msg, qrimg);
cv::imwrite("qrimg.png", qrimg);
How to fix
I feel changing the version information area is better.
- for (int i = 0; i <= 6; i++)
+ for (int i = 0; i <= 5; i++)
Issue submission checklist
System information (version)
Detailed description
A part of timing Pattern is broken. (Same as left-bottom parts).
Timing pattern is used to determine version. So QRCodeDetector cannot decode it.
Left image is expected output. Right image is current output.
Reason
Version information and timing pattern is overlapped when ( i== 6 or j == 6).
https://github.com/opencv/opencv/blob/3.4/modules/objdetect/src/qrcode_encoder.cpp#L976
Steps to reproduce
How to fix
I feel changing the version information area is better.
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found any solution