title: How to replace a masked part of an image with another image using openCV python?
body: <p>The objective is to replace a part of an image with another image. What I plan to do is to get the segment map of the original photo, and replace the selected part of the original with another image.</p>
  <p>For example, This is a photo of the original photo's segment map:</p>
  <p><a href="https://i.stack.imgur.com/M7Eah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M7Eah.png" alt="Segment map of original photo" /></a></p>
  <p>And I want to replace that pink segment mask with another guy model (different person):</p>
  <p><a href="https://i.stack.imgur.com/deFDl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/deFDl.jpg" alt="Sample guy to replace" /></a></p>
  <p>How should I do so about it? I am thinking of selecting an ROI based on the pink colour <em>(RGB Values of 192,128,128)</em> and <code>bitwise_and</code> the two images? But I'm not too sure on how to do that, or if that's the best approach.</p>
  <p>I am aware that the pink mask and the sample guy are not the exact fit, but I just want to be able to fit the model in the pink segment first, and perhaps scale or transform it afterwards.</p>
  <p>Any suggestions will be great! Thank you!</p>