Difficulty in decoding few data matrix

These are my sample Data matrix that couldn’t be decoded.

I changed Example program code

sensor.set_pixformat(sensor.RGB565)

to

sensor.set_pixformat(sensor.GRAYSCALE)

.

Even then, It’s not decoding. Can anyone help me in this regard?

Hi, we can’t decode data matrixes like that. They aren’t even close to the binary black and white ones that the library is meant for. If you want to decode a data matrixes like that you’re going to have to preprocess the image to get a black and white image.

What I mean by this is to look at the data matrixes I show off in the video. The ones you are trying to process do not look similar.

That said, you can fix this however. The first step is to threshold the image. Please use the binary() method and the threshold editor to try to threshold the to black and white and see if this works. If it doesn’t, then you’re going to have to do something more complex.

Anyway, let me know how thresholding works and if you can get the thresholds to work well for you. What you are trying to do is legitimately hard and requires upfront image processing to extract a standard looking data matrixes code from the image. The data matrix library we use directly cannot work on a low contrast image like that directly.