title: OpenCV mask resulting
body: <p>checking simple mask applications:</p>
  
  <pre><code>im1=cv.imread('test.png')
  im2=cv.imread('test2.png')
  mask=cv.imread('mask.png')
  
  res1=cv.matchTemplate(im1,im1,cv.TM_SQDIFF)
  res2=cv.matchTemplate(im2,im1,cv.TM_SQDIFF)
  
  res1m=cv.matchTemplate(im1,im1,cv.TM_SQDIFF,mask)
  res2m=cv.matchTemplate(im2,im1,cv.TM_SQDIFF,mask)
  </code></pre>
  
  <p>But as a result i always get the same.
  Here are my images: <a href="https://imgur.com/a/Zkznp" rel="nofollow noreferrer">https://imgur.com/a/Zkznp</a></p>
  
  <p>What's the problem? I should get the same res1m and res2m,due to formula:</p>
  
  <blockquote>
    <p>SUM[W(x,y)*(I(x,y)-T(x,y))^2],W-mask,I-image,T-template</p>
  </blockquote>