I'm trying to make a DataMatrix reader in javascript that can process an image and extract the information in there. The problem is with detecting the square inside the image with the datamatrix, as this can vary in location and orientation. The input image looks like this:
I want to find and extract only that part (square) of the image that shows the datamatrix, from there on out I have the processing/decoding covered. The desired result for the image above would be:
I need this picture as an ImageData array of some kind, so that I can use that as input for further processing. I am stuck as to how to approach this, how to get the image orientated correctly and the right subsection of the image selected. Is there anyone who has some suggestions/solutions on how to approach this?
Thanks in advance!