title: Find location of image inside bigger image
body: <p>So i have an image lets say <code>small.png</code> and a bigger image <code>big.png</code> .The small image occurs 2 times in the bigger image and i wish to find its location.</p>
  
  <p>I tried using numpy and Image but got error </p>
  
  <p><code>'JpegImageFile' object has no attribute '__getitem__'</code>.I had <code>png</code> format earlier and it gave the same error.</p>
  
  <p>Is there any other module or way to get this done.I am open to any .</p>
  
  <p>The code as of now which throws error is</p>
  
  <pre><code>import numpy
  from PIL import Image
  here = Image.open(r"/Users/vks/Desktop/heren.jpg")
  big = Image.open(r"/Users/vks/Desktop/Settingsn.jpg")
  print here,big
  herear = numpy.asarray(here)
  bigar = numpy.asarray(big)
  herearx = herear.shape[0]
  hereary = herear.shape[1]
  
  bigarx = bigar.shape[0]
  bigary = bigar.shape[1]
  
  print herearx , hereary , bigarx, bigary
  
  stopx = bigarx - herearx + 1
  stopy = bigary - hereary + 1
  
  for x in range(0, stopx):
      for y in range(0, stopy):
          x2 = x+ herearx
          y2 = y + hereary
          pic = big[y:y2, x:x2] ===&gt; error thrown here
          test = pic = here
          if test.all():
              print x,y
  else:
      print "None"
  </code></pre>
  
  <p>There was another <code>cv2</code> module but it just doesnt get installed on my mac.
  <code>pip install cv2</code> fails saying on package found.</p>
  
  <p><a href="https://i.stack.imgur.com/VBwmB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VBwmB.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/KGHhI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KGHhI.png" alt="enter image description here"></a></p>