0

I'm using OpenCV wherein I'm trying to copy one image with a certain level of transparency on to the top of another one image. But in the end, instead of having the transparent image, I see the whole checkered background. Both images have 4 channels. The image with the flowers was obtained with the GrabCut method and then transformed to a BGRA.

I`m copying the image normally using:

  flowers.copyTo(newimg(Rect(0,0, flowers.cols, flowers.rows)));
  imwrite("test.png", newimg);

Any ideas of why this is happening?

enter image description here

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
theUnkownName
  • 15
  • 1
  • 6
  • You can see how to add a transparent image from [THIS POST](http://stackoverflow.com/questions/41376337/applying-overlays-to-image-with-varying-transparency/41381887#41381887) I answered a month ago. The code is in python, but you can easily convert to C++. – Jeru Luke Jan 09 '17 at 20:10
  • copyTo just overwrites everything, it doesn't "apply" transparency. – Micka Jan 09 '17 at 22:28
  • take a look at [this](http://stackoverflow.com/a/37087972/5294258) – sturkmen Jan 10 '17 at 10:09
  • Thank you guys!! Both links were helpful! – theUnkownName Jan 16 '17 at 10:18

0 Answers0