1

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:

Input Image

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:

enter image description here

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!

Evertvdw
  • 827
  • 10
  • 17
  • 1
    First, you'd have to write something which recognizes edges in an image (not exactly easy) then you'd have to take those edges and be able to recognize semi-rectangular sections (again, not exactly easy) then copy that section of the image and rotate it. I think your question is too broad to be answer on Stack Overflow. – Mike Cluck Jun 30 '17 at 14:09
  • Would it also be possible to map some sort of white square onto the image with different orientations to see on which coordinates this matches best with the image? I agree that ur method is to complicated for an answer here but I was hoping for some shortcuts :) – Evertvdw Jun 30 '17 at 14:14
  • You'd still need to perform edge detection to see if your overlay matched up with the area of interest as well as figure out where to attempt to overlay it in the first place. Otherwise, you'd have to try a near infinite number of possibilities. – Mike Cluck Jun 30 '17 at 14:37
  • The important part of the solution is the data contained in the matrix, a key that all matrices share, that when found tells the system you have what you are after. There are a million and one ways to find a square area in an image and each methods has it pros and cons. All methods will at some point fail. To prevent false positives the key can only be read if the system gets the orientation/scale/etc correct. Once you have found the key the rest is easy. This will greatly simplify the whole process. – Blindman67 Jul 01 '17 at 07:32

0 Answers0