title: Copy and paste region of image in opencv?
body: <p>I'm stuck at <a href="http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_core/py_basic_ops/py_basic_ops.html#image-roi" rel="noreferrer" title="this">this</a> tutorial where a ROI is pasted over another region of same image. Python trows a value error when I try something similar:</p>
  
  <pre><code>img = cv2.imread(path, -1)
  eye = img[349:307, 410:383]
  img[30:180, 91:256] = eye
  </code></pre>
  
  <p>Exeption:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 13, in &lt;module&gt;
      img[30:180, 91:256] = eye
  ValueError: could not broadcast input array from shape (0,0,3) into shape (150,165,3)
  </code></pre>
  
  <p>This might be very newb question, but I couldn't come up with an answer by searching on google. Are there other numpy methods for doing this?</p>
  
  <p>EDIT: Also in the tutorial its not specified how the coordinates should be entered. Ex: I can enter coords of the region I want something like: <code>eye = img[x1:y1, x2:y2]</code> or <code>img[x1:x2, y1:y2]</code>. This is what confusing to me. Actually I tried to get these coords from a mouse callback method which printed the position of the mouse click. So, the coordinates are surely from the inside of image. </p>