title: Need to copy one image to another image ROI
body: <p>I am trying to copy one image layer to another image ROI. My code is given below.</p>
  
  <pre><code>Mat4b src= imread("path");
  Mat3b dest = imread("path");
  Rect roi = Rect(179,539,src.cols,src.rows); //src.cols = 1186 and src.rows= 1134 after scaling.
  Mat destinationROI = dest(roi);
  src.copyTo(destinationROI);
  imwrite("destinationROI.png", destinationROI);
  </code></pre>
  
  <p>The input src is <a href="https://i.stack.imgur.com/HPjT8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HPjT8.jpg" alt="enter image description here"></a>
  The input dest is <a href="https://i.stack.imgur.com/XesTf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XesTf.jpg" alt="enter image description here"></a></p>
  
  <p>But the output got is the same dest image. 
  Then I tried to save destinationROI befre copying. The output I got is <a href="https://i.stack.imgur.com/qYBsw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qYBsw.jpg" alt="enter image description here"></a> Which is correct one. Copying the src is also working. But it does not make any effect in the dest image.</p>