title: OpenCV Python copying certain portion of image to another
body: <p>I want to calculate the difference betwwn two images. I'm only interested in the difference value for a certain portion of image. For that i am copying the required portion of image to a temp images, and operating on those images. However using the pixel allocation using as specified on <a href="http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_core/py_basic_ops/py_basic_ops.html" rel="nofollow">http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_core/py_basic_ops/py_basic_ops.html</a>. Here it is given, </p>
  
  <p><code>ball = img[280:340, 330:390]
   img[273:333, 100:160] = ball</code></p>
  
  <p>Using the similar logic, i have written a python program,</p>
  
  <pre><code>import cv2
  import numpy as np
  
  img_file = 'carparking2_1.jpg'
  img = cv2.imread(img_file, cv2.IMREAD_COLOR)
  img_withoutcar = 'carparking2_1.jpg'
  img_withcar = 'carparking2.jpg'
  
  img1 = img_withoutcar[47:151, 106:157]
  img2 = img_withcar[47:151, 106:157]
  
  diff1 = cv2.absdiff(img1, img2)
  diff2 = cv2.absdiff(img1, img1)
  
  print 'RGB shape: ', img.shape        # Rows, cols, channels
  print 'Difference with car and without: ', diff1
  print 'Difference with car and with car: ', diff2
  </code></pre>
  
  <p>However, im getting the output message: </p>
  
  <pre><code>File "D:/Projects/IoT Smart Parking/differenceinframes.py", line 8, in &lt;module&gt;
      img1 = img_withoutcar[47:151, 106:157]
  TypeError: string indices must be integers, not tuple
  </code></pre>
  
  <p>I am running Python 2.7 with OpenCV 3.1.0 on Windows 10.</p>