Issue with data matrix code detection and correction

Hello,

I’m using your openmv lib but directly in C on an STM32H747I-DISCO board to make image processing. I have been able to perform successfully barcode decoding using your implementation of the zbar library. I tried to do the same for data matrix decoding but it doesn’t seem to work…
I have spent a week on this matter with no success so far. The dmtx library detects correctly the datamatrix (amount of rows and columns are correct for example in the DmtxRegion structure) but it fails in the RsDecode function. The RsFindErrorLocations function keeps saying that the code is not repairable. When I comment this line, then the library does give me an output but it’s garbage… However, it’s a code that is always the same if I don’t change the data matrix. If I change the data matrix, I get a new code (which is still garbage) so that makes me think, that somehow, the identification of the data matrix works well but something is broken somewhere in the pipe…

I’m feeding all the correct parameters to the function “imlib_find_datamatrices” which are almost the same ones than “imlib_find_barcodes”. The only difference is the integer effort. I have tried with several values (100,1000,2000,3000…10000) but none of them would give me satisfaction.

Can you help me with this matter please?

Thanks in advance,
Houssem

Okay latest update, it works!! For some reason, the library is correctly identifying the data matrix but it’s somehow rotated or swapped.

In the function “PopulateArrayFromMatrix”, if I replace this line
if(tally[mapRow][mapCol]/(float)weightFactor >= 0.5)
with this one:
if(tally[mapCol][mapRow]/(float)weightFactor >= 0.5)
It finally works

Huh, is your data matrix printed incorrectly? Because the method works on regular data matrices online.

Nop, I used this website to generate my data matrix: Free Online Barcode Generator: Data Matrix

Can you try another one and see if the data matrixes are the same?

Sorry by nop I actually meant yes. I used this website and I got these results with this website. I also tried other websites so I’m pretty sure my data matrices are printed correctly

Weird. Okay. Do you think the code then needs to be patched? If so, please send a PR and we’ll merge it into main.