title: How to overlay images using OpenCv?
body: <p>How can I overlay two images? Essentially I have a background with no alpha channel and than one or more images that have alpha channel that need to be overlaid on top of each other.</p>
  
  <p>I have tried the following code but the overlay result is horrible:</p>
  
  <pre><code>// create our out image
  Mat merged (info.width, info.height, CV_8UC4);
  
  // get layers
  Mat layer1Image = imread(layer1Path);
  Mat layer2Image = imread(layer2Path);
  
  addWeighted(layer1Image, 0.5, layer2Image, 0.5, 0.0, merged);
  </code></pre>
  
  <p>I also tried using merge but I read somewhere that it doesn't support alpha channel?</p>