Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro QR-codes are not detected #395

Open
acriba opened this issue Jun 9, 2023 · 4 comments
Open

Micro QR-codes are not detected #395

acriba opened this issue Jun 9, 2023 · 4 comments
Assignees

Comments

@acriba
Copy link

acriba commented Jun 9, 2023

We are trying to use nano qr codes because we need to encode very little information and would like to minimize size. The codes are mostly detected but there are some qr codes that can't be decoded and I have no idea where the problem lies. It seems that somehow the position of the qr code is completely misdetected, which results in an error ERROR_CORRECTION. I have painted the detected bounding boxes above the samples. I include also a few succesful examples - I don't have an idea why the boundaries are not detected correctly in these cases. The qr-codes are generated with boofcv. Maybe somebody has a hint or something can be improved?
success03
success02
success01
error03
error02
error01

@lessthanoptimal
Copy link
Owner

lessthanoptimal commented Jun 9, 2023 via email

@acriba
Copy link
Author

acriba commented Jun 9, 2023

Hello Peter, I appreciate your your help - thank you very much.

We are using BoofCV to create the Micro QR code (sorry for using the wrong name before). We are not using thresholding, we convert the original image with to a grayscale image.

I have attached the grayscale image gray that is used by the detector. We convert the original color image with ConvertBufferedImage.convertFromSingle(original, null, GrayU8.class);:

	var config = new ConfigMicroQrCode();
	MicroQrCodeDetector<GrayU8> detector = FactoryFiducial.microqr(config, GrayU8.class);
	detector.process(gray);

Christian
error_gray_original_03
error_gray_original_02
error_gray_original_01

@acriba acriba changed the title Nano QR-codes are not detected Micro QR-codes are not detected Jun 12, 2023
@lessthanoptimal
Copy link
Owner

Sorry for taking a bit to reply. The images you posted look a bit noisy. Can you paste the code you used to generate these markers? It's also possible that they are somehow in an illegal state. I hope to be able to dive into this soon.

@acriba
Copy link
Author

acriba commented Jul 2, 2023

Hello Peter,

here would be the code that we are using to generate the Codes:

public byte[] getMicroQrCode() {

	MicroQrCode qr = new MicroQrCodeEncoder()
			.setError(MicroQrCode.ErrorLevel.M)
			.addAutomatic(getData())
			.fixate();

	GrayU8 rendered = MicroQrCodeGenerator.renderImage(3, 2, qr);
	BufferedImage image = ConvertBufferedImage.convertTo(rendered, null);

	try(ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
		ImageIO.write(image, "png", baos);
		return baos.toByteArray();
	} catch (IOException e) {
		throw new RuntimeException(e);
	}

}

I don't think the codes could end up in an illegal state?

Christian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants