title: Want transparent image even after blending
body: <p>I am trying to blend two images as shown <a href="https://stackoverflow.com/questions/17822585/copy-blend-images-of-different-sizes-using-opencv">here</a>.</p>
  
  <p>This is my whole code</p>
  
  <pre><code>#include &lt;cv.h&gt;
  #include &lt;highgui.h&gt;
  #include &lt;iostream&gt;
  
  using namespace cv;
  
  int main( int argc, char** argv )
  {
   double beta; double input;
  
   Mat src1, src2, dst;
  
   /// Ask the user enter alpha
   std::cout&lt;&lt;" Simple Linear Blender "&lt;&lt;std::endl;
   std::cout&lt;&lt;"-----------------------"&lt;&lt;std::endl;
  
   src1 = imread("face.jpg");
   src2 = imread("necklace1.png");
  
   if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
   if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
  
   double alpha = 0.1; // something
   int min_x = ( (src1.cols - src2.cols)/2 );
   int min_y = ( (src1.rows - src2.rows)/2 );
   int width, height;
  
   // min_x, min_y should be valid in src1 and [width height] = size(src2)
   cv::Rect roi = cv::Rect(min_x, min_y, src2.cols, src2.rows);  
  
   // "out_image" is the output ; i.e. src1 with a part of it blended with  src2
   cv::Mat out_image = src1.clone();
  
   // Set the ROIs for the selected sections of src1 and out_image (the same at the moment)
   cv::Mat src1_roi= src1(roi);
   cv::Mat out_image_roi = out_image(roi);
  
   // Blend the ROI of src1 with src2 into the ROI of out_image
   cv::addWeighted(src1_roi,alpha,src2,1-alpha,0.0,out_image_roi);
  
   imshow( "Linear Blend", out_image );
  
   waitKey(0);
   return 0;
  }
  </code></pre>
  
  <p>My input images are
  <a href="https://i.stack.imgur.com/pu4yY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pu4yY.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/AY9hC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AY9hC.png" alt="enter image description here"></a></p>
  
  <p>But the output got is </p>
  
  <p><a href="https://i.stack.imgur.com/7tGR7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7tGR7.png" alt="enter image description here"></a></p>
  
  <p>I want this necklace as transparent as before. How to do it?</p>
  
  <p>I tried <code>cvtColor( out_image_roi,out_image_roi, CV_BGR2BGRA );</code>before <code>cv::addWeighted(src1_roi,alpha,src2,1-alpha,0.0,out_image_roi);</code></p>
  
  <p>But then the output is only the face image. </p>