title: How do detect a QR code pattern in an image?
body: <p>I'm working on a QR detector code and I need to locate the Finding Patterns (FP) on an image. I have created a binary template resembling the squares you find on the corners of QR codes as:</p>
  
  <pre><code>FP = ones(9);
  FP(2:8,2:8)=0;
  FP(3:7,3:7)=1;
  FP(4:6,4:6)=0;
  figure;imshow(FP)
  </code></pre>
  
  <p>And I have tried looking for the points in the image with maximum correlation with this template using <code>xcorr2</code>. My problem is obvious: My template is very small compared to the actual sizes QR codes might have on the images.</p>
  
  <p>Is there a way of looking for a pattern/mask without having to resize it? Is there another approach to this problem?</p>
  
  <p>As an example, here's an image with a QR code</p>
  
  <p><img src="https://i.stack.imgur.com/mlw1K.jpg" alt="enter image description here"></p>