Here's the patch; sorry if there are formatting errors. These specifically fix the case of a single-row image, but the second changed line also achieves what I think you were trying to do when combining multiple lines.
Beyond this patch, the changes I've made have been very extensive, with a lot of renaming and some refactoring.
I would like to know what you were doing with the 3of9 class, in _getCharacter(). Those lines comparing the string to "000" and "111" are completely wrong; that logic was obviously never tested, because it would never work. But even beyond that, it's not at all clear what's going on -- is this some attempt at on-the-fly error correction?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No new activity for over two years.
I'm writing a plugin for ImageJ using this code as a basis. I've fixed a minor bug; I could provide a patch if desired.
I would love to see any improvements you of made.
Andi,
Here's the patch; sorry if there are formatting errors. These specifically fix the case of a single-row image, but the second changed line also achieves what I think you were trying to do when combining multiple lines.
==============================================
Index: M:/Projects/ImageJ/Barcode_Recognizer/uk/org/JBarcode_Recognition/Barcodes/Barcode.java
===================================================================
--- M:/Projects/ImageJ/Barcode_Recognizer/uk/org/JBarcode_Recognition/Barcodes/Barcode.java (revision 1)
+++ M:/Projects/ImageJ/Barcode_Recognizer/uk/org/JBarcode_Recognition/Barcodes/Barcode.java (revision 2)
@@ -77,7 +77,7 @@
public static Barcode getBarcode(boolean[][] image, boolean invert,
boolean reverse, int typeHint)
{
- for (int loop = 1; loop < image.length; ++loop)
+ for (int loop = 1; loop==1 || loop < image.length; ++loop)
{
Barcode barcode = Barcode._combineAndCheck(image, loop, invert,
reverse, typeHint);
@@ -422,7 +422,7 @@
private static Barcode _combineAndCheck(boolean[][] image, int size,
int offset, boolean invert, boolean reverse, int typeHint)
{
- if (size + offset >= image.length)
+ if (size + offset > image.length)
{
return null;
}
==============================================
Beyond this patch, the changes I've made have been very extensive, with a lot of renaming and some refactoring.
I would like to know what you were doing with the 3of9 class, in _getCharacter(). Those lines comparing the string to "000" and "111" are completely wrong; that logic was obviously never tested, because it would never work. But even beyond that, it's not at all clear what's going on -- is this some attempt at on-the-fly error correction?