#java #zxing #zxing.net #zxing-js
#java #zxing #zxing.net #zxing-js
Вопрос:
Мне удалось отсканировать файл TIFF с помощью ZXING. в этом файле содержится 4 1D штрих-кода, но ZXING выводит 2 горизонтальных штрих-кода. Как можно сканировать штрихкоды вертикалей? Текущий код успешно сканирует ТОЛЬКО горизонтальные штрих-коды, но не смог обнаружить вертикальные штрих-коды?
Вот мой код:
public static void main(String[] args) throws IOException, NotFoundException {
InputStream barCodeInputStream = new FileInputStream("C:/Temp/test.tif");
BufferedImage barCodeBufferedImage = ImageIO.read(barCodeInputStream);
LuminanceSource source = new BufferedImageLuminanceSource(barCodeBufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
com.google.zxing.Reader reader = new MultiFormatReader();
MultipleBarcodeReader bcReader = new GenericMultipleBarcodeReader(reader);
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
StringBuilder sb = new StringBuilder();
for (Result result : bcReader.decodeMultiple(bitmap, hints)) {
sb.append(result.getText()).append(" n");
}
System.out.println(sb.toString());
}