How do I decode a Data Matrix barcode using the raw code word data?

8 views (last 30 days)
I am working on Image Processing techniques to binarize a Data Matrix barcode image. I create a matrix of 1's and 0's. I want to be able to pass that raw data into a function to spit out the resulting code. All decoding software/algorithms must have a function for this last step so this should be easily done.
For instance, if I have this 8X18 Data Matrix Barcode (with optional zero padding)
bits = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0;
0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 1 0 1 0 0;
0 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0;
0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 0 1 1 0 1 0 0;
0 0 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0;
0 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 1 0 0;
0 0 1 1 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0;
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ];
DMstring = DecodeDataMatrix(bits);
This function I envision should easily be able to return the decoded string (assuming I have given a valid code):
DMstring = 0030140059

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!