Skip to content

Problem with QRCodeEncoder#encodeStructuredAppend function #24851

@fjs-tantran

Description

@fjs-tantran

System Information

OpenCV version: 4.9.0
Operating System / Platform: Windows 64 Bit
Language: Java

Detailed description

Hello there ! I’m working with OpenCV in order to generate QR Codes.
I want to use the function encodeStructuredAppend
If I try with params.structure_number = 3 it generates 3 QR code with all the informations in it but if I use QR Scan Tool, it cannot read correct.

Result:
Scan image 1: QRCode Structure Append: 4 of 3 was found.
Scan image 2: QRCode Structure Append: 3 of 3 was found.
Scan image 3: QRCode Structure Append: 2 of 3 was found.

Steps to reproduce

// java code sample
package test1;

import java.util.ArrayList;
import java.util.List;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.QRCodeEncoder;
import org.opencv.objdetect.QRCodeEncoder_Params;

public class opencv_demo {

public static void main(String[] args) {
	
	// TODO Auto-generated method stub
	System.loadLibrary("opencv_java490");
	
	QRCodeEncoder_Params param = new QRCodeEncoder_Params();
	param.set_structure_number(3);
	
	List<Mat> qrcodes = new ArrayList<Mat>();
	
	QRCodeEncoder.create(param).encodeStructuredAppend("Some text to test, more or less big, i tried differents things, 123456", qrcodes);

	for(int i = 0; i < qrcodes.size(); i++) {
		
		Mat qrcode = qrcodes.get(i);
        
		Mat dst = new Mat();
		Size size = new Size(256, 256);
		
		Imgproc.resize(qrcode, dst, size, 0, 0, Imgproc.INTER_AREA);
		Imgcodecs.imwrite("D:\\test\\demo" + String.valueOf(i)+ ".png", dst);
		
	}
}

}

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions