Tag: 条码

从图像中检测并解码多个2d(Datamatrix,QRcode)

我正在开展一个项目,包括将图像文件作为输入放在我的桌面上,然后检测和解码所有存在的条形码,包括1D和2D。 我一直在使用zxing,在GenericMultipleBarcodeReader的帮助下,我能够从图像中读取多个1D条形码。 但是,它无法检测到二维条形码。 但是,如果我裁剪2D条形码并分别输入这个裁剪部分,它会检测并解码它没有任何问题。 因此,如果我的图像有2个1D条形码和2D条形码,我的输出只包含解码的2个1D条形码。 我也尝试过使用ByQuadrantReader,但这也不起作用。 我的代码: LuminanceSource source = new BufferedImageLuminanceSource(image); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Result[] result; HashMap hints = new HashMap(); hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); try { result = new GenericMultipleBarcodeReader(new MultiFormatReader()).decodeMultiple(bitmap, hints); } catch (ReaderException re) { return re.toString(); } List strings = new ArrayList(); for (Result r: result) { strings.add(r.getText()); } […]

zxing ean13条形码编码带’lead’,’separator’和’trailer’

我正在使用zxing生成EAN13条形码。 使用此代码时,一切正常: new EAN13Writer().encode(eanValue, BarcodeFormat.EAN_13, requestedWidth, requestedHeight); 结果: 现在,客户希望拥有像这样的铅 , 分离器和拖车 : ( 图片来源 ) 据我所知,zxing的代码(见这里 )我上面使用的代码不能比其他代码更长。 但是我发现EAN13Writer中有两个编码方法,看起来,第二个编码函数完全符合我的要求。 但问题是这个函数不会返回一个bitmatrix而是一个布尔数组。 (编辑:没有function没有实现我想做的事) 谁能告诉我如何才能实现第二种条码风格?

在android上,detector.isOperational()总是假的

我正在使用新的谷歌播放服务 : 条形码检测器 ,对于这个porposue我正在遵循这个教程: https ://search-codelabs.appspot.com/codelabs/bar-codes 但是,当我在我的真实设备(华硕Nexus 7)上运行应用程序时,应用程序的文本视图始终显示“无法设置检测器”,我不知道如何使其工作> <.. 。 这里有一些快速调试的代码: public class DecoderBar extends Activity implements View.OnClickListener{ private TextView txt; private ImageView img; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_decoder); Button b = (Button) findViewById(R.id.button); txt = (TextView) findViewById(R.id.txtContent); img = (ImageView) findViewById(R.id.imgview); b.setOnClickListener(this); } // […] @Override public void onClick(View v) { […]