我的目标是在像这样的大图像上检测多个数据矩阵(四大):
基于几个代码示例,我做了一个小测试程序:
Bitmap image = getImage();
DataMatrixReader reader = new DataMatrixReader();
GenericMultipleBarcodeReader genericReader = new genericMultipleBarcodeReader(reader);
Dictionary hints = new Dictionary();
hints.Add(DecodeHintType.TRY_HARDER, true);
BitmapLuminanceSource source = new BitmapLuminanceSource(image);
HybridBinarizer binarizer = new HybridBinarizer(source);
BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
Result[] results = genericReader.decodeMultiple(binaryBitmap,hints);
show(results);
它无法检测到大图像上的任何代码.
但它可以检测到代码,当它被裁剪时:
之后我合并了两个生成的数据矩阵,它也失败了:
最后我用略微裁剪的图片再进行了两次测试,两次都失败了:
所以看起来这个库根本不健壮,或者我使用它错了.
知道如何改善我的结果吗? (包括其他库和预处理)