Hello,
I am testing your software reading all the posible barcodes present in a multipage TIFF file. This is my code:
public static void main(String[] args) throws Exception {
test.performTestAspose();
}
private void performTestAspose() throws Exception {
long t0 = System.currentTimeMillis();
License license = new License();
license.setLicense(“Z:\Aspose.BarCode.lic”);
SeekableStream ss = new FileSeekableStream(“Z:\tests\20130528092912147\20130528092912147.tif”);
ImageDecoder decoder = ImageCodec.createImageDecoder(“tiff”, ss, null);
int numPages = decoder.getNumPages();
com.aspose.barcoderecognition.BarCodeReader reader = null;
for(int j = 0; j < numPages; j++) {
PlanarImage op = PlanarImage.wrapRenderedImage(decoder.decodeAsRenderedImage(j));
BufferedImage bufferedImage = op.getAsBufferedImage();
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, “png”, os);
InputStream is = new ByteArrayInputStream(os.toByteArray());
reader = new com.aspose.barcoderecognition.BarCodeReader(is, BarCodeReadType.Code128);
int barcodeCounter = 1;
while (reader.read()) {
System.out.println("------ Page " + (j + 1) + ". Number of code: " + barcodeCounter + “---------”);
System.out.println(“Code: " + reader.getCodeText() + “. Orientation: " + reader.getBarCodeOrientation());
System.out.println(“Points: (” + reader.getRegion().getPoints()[0] + “,” + reader.getRegion().getPoints()[1] +
“,” + reader.getRegion().getPoints()[2] + “,” + reader.getRegion().getPoints()[3] + “)”);
System.out.println(”-----------------------------------------\n”);
barcodeCounter++;
}
}
ss.close();
if (reader != null) {
reader.close();
}
long t1 = System.currentTimeMillis();
System.out.println(“Time performTestBufferedImage(): " + (t1 - t0) / 1000 + " seconds”);
}
I am experimenting different problems with the image I attach. The output of the program with this image is:
------ Page 3. Number of code: 1---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=2445,Y=912},{X=2657,Y=912},{X=2658,Y=1775},{X=2446,Y=1775})
-----------------------------------------
------ Page 3. Number of code: 2---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=727,Y=192},{X=1586,Y=192},{X=1586,Y=401},{X=727,Y=401})
-----------------------------------------
------ Page 3. Number of code: 3---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=263,Y=1825},{X=1122,Y=1823},{X=1122,Y=2034},{X=263,Y=2036})
-----------------------------------------
------ Page 3. Number of code: 4---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=9,Y=248},{X=219,Y=248},{X=218,Y=1110},{X=8,Y=1110})
-----------------------------------------
------ Page 4. Number of code: 1---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=2452,Y=919},{X=2662,Y=919},{X=2661,Y=1781},{X=2451,Y=1781})
-----------------------------------------
------ Page 4. Number of code: 2---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=735,Y=196},{X=1594,Y=197},{X=1594,Y=406},{X=735,Y=405})
-----------------------------------------
------ Page 4. Number of code: 3---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=268,Y=1829},{X=1127,Y=1829},{X=1127,Y=2038},{X=268,Y=2038})
-----------------------------------------
------ Page 5. Number of code: 1---------
Code: EA8@ZF V[EZL@Y. Orientation: 4
Points: ({X=2445,Y=915},{X=2657,Y=915},{X=2655,Y=1777},{X=2443,Y=1777})
-----------------------------------------
------ Page 6. Number of code: 1---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=2444,Y=914},{X=2655,Y=914},{X=2655,Y=1776},{X=2444,Y=1776})
-----------------------------------------
------ Page 6. Number of code: 2---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=726,Y=196},{X=1584,Y=195},{X=1584,Y=403},{X=726,Y=404})
-----------------------------------------
------ Page 6. Number of code: 3---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=260,Y=1828},{X=1121,Y=1826},{X=1121,Y=2037},{X=260,Y=2039})
-----------------------------------------
------ Page 6. Number of code: 4---------
Code: EASYAPANEXO. Orientation: 4
Points: ({X=7,Y=250},{X=216,Y=250},{X=216,Y=1112},{X=7,Y=1112})
-----------------------------------------
Time performTestBufferedImage(): 34 seconds
Barcodes present in pages 1 and 2 are not being recognized. Page 4 has 4 barcodes and only 3 are detected. Page 5 has quite bad quality so I guess this is normal. Why reader.getBarCodeOrientation() is always printing the value 4? Is not supposed to print the orientation of the barcode detected?
Another issue is the time invested to process the entire file. 34 seconds is quite a bit of time for a 6 page file. Am I doing something wrong? Is there anything I can do to speed up the whole process?
Thank you very much.