This project has moved. For the latest updates, please go here.

CODE39 not recognized

Jul 30, 2013 at 9:18 AM
I had trouble with a code39 barcode, using another lib the barcode was correctly decoded.

then in debug I stumbled over this piece of code
// If 50% of last pattern size, following last pattern, is not whitespace, fail
// (but if it's whitespace to the very end of the image, that's OK)
if (nextStart != end && (whiteSpaceAfterEnd >> 1) < lastPatternSize)
{
    return null;
}
my english is pretty awful but I think the correct code should be as follows
// If 50% of last pattern size, following last pattern, is not whitespace, fail
// (but if it's whitespace to the very end of the image, that's OK)
if (nextStart != end && whiteSpaceAfterEnd < (lastPatternSize >> 1))
{
    return null;
}
after I made that change the barcode was decoded succesfully.
Coordinator
Jul 30, 2013 at 6:28 PM
Can you please post a sample image?