transparently overlay two images with Java
Hey,
I am working with opencv for a few days. I would like to write a program which overlays two images and at the end i´ll have a picture on which all contents of the two images are included. I've searched everywhere but found only tutorials written with c ++ and not in java.it would be cool if someone could help me. Thank you very much
P.S. sorry for my bad english!
opencv is a computer-vision library, and usually ignores all things alpha (they're irrelevant)
you do not need opencv, for what you're trying, and you better should look for something else, like imageJ
It does however go to show that OpenCV handles 4-channel PNG images, with transparency intact. The blending between the two images is up to you.
I notice that although there's transparency data, the imshow function doesn't take the transparency data into account; it draws everything with 0 transparency by default. I used Pixelmator to create the file bg.png by setting the first layer's transparency to 50%.
GIMP also exports 4-channel PNG files.
Your blending will probably look something like this:
@sjhalayka -- why would any of this require using opencv ?
@berak If I were doing something like this, I'd use OpenCV simply for the ease of loading image files. I found this might work too:
https://www.learnopencv.com/alpha-ble...