我的目标是在这样一个更大的图像(四大)上检测多个数据:

基于几个代码示例,我编写了一个小测试程序:
Bitmap image = getImage();
DataMatrixReader reader = new DataMatrixReader();
GenericMultipleBarcodeReader genericReader = new genericMultipleBarcodeReader(reader);
Dictionary<DecodeHintType, object> hints = new Dictionary<DecodeHintType,object>();
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);它无法检测到大图像上的任何代码。
但是它可以检测到代码,当它这样裁剪时:

之后,我合并了两个生成的数据矩阵,它也失败了:

上一次,我用稍微剪裁过的图像进行了两次测试,都失败了:


所以看起来这个库一点也不健壮,或者我使用错了。
知道如何提高我的成绩吗?(包括其他图书馆和预处理)
发布于 2015-01-30 07:05:46
不能说库不够健壮,但这里有两个关键因素影响您:
我的建议是在考虑到我提到的内容的情况下实现您自己的MultipleBarcodeReader。
一种天真的方法可能是以点网格为中心的样本图像,这样每个数据矩阵(无论其在图像中的位置)至少包含其中的一个点。你只需要确保排除重复的代码。
https://stackoverflow.com/questions/28074479
复制相似问题