Using this code, I cannot get zxing to decode the attached image. dmtxread can read it, but I've used it enough to know it can return bad decodes.
It's written in scala, but I think it is pretty clear.
object Main {
def main(args: Array[String]): Unit = {
val curr_barcode = "/Users/cwischmeyer/git/scala_barcode/src/test_5.jpg"
println(curr_barcode)
val image = ImageIO.read(new File(curr_barcode)
val hint = new util.Hashtable[DecodeHintType, Object]()
hint.put(DecodeHintType.TRY_HARDER, java.lang.Boolean.TRUE)
hint.put(DecodeHintType.POSSIBLE_FORMATS, List(BarcodeFormat.DATA_MATRIX))
val lumSource = new BufferedImageLuminanceSource(image)
val bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(lumSource))
val decoder = new DataMatrixReader()
println(decoder.decode(bitmap, hint).getText())
}
}
Any ideas on what I can do to increase the decoding success rate?
Congrats on 10 years!
-Corey
Ah! Okay, this is similar to the approach I am using now. I wasn't sure if I was missing something already builtin, or if modifying contrast would interfere with what the library is already trying to do.
Thanks for taking the time!