Png transparent, text problems with glow
I'm trying to place a logo into a background. The logo has text with glow.
When I put it on the background it only outputs the white part (and removes the black glow)
Here's the code:
import cv2
import numpy as np
# importing the main image
image = cv2.imread("flower.jpg")
# importing the logo image
watermark = cv2.imread("asdasd.png", -1)
(wH, wW) = watermark.shape[:2]
(B, G, R, A) = cv2.split(watermark)
B = cv2.bitwise_and(B, B, mask=A)
G = cv2.bitwise_and(G, G, mask=A)
R = cv2.bitwise_and(R, R, mask=A)
watermark = cv2.merge([B, G, R, A])
(h, w) = image.shape[:2]
image = np.dstack([image, np.ones((h, w), dtype="uint8") * 255])
# construct an overlay that is the same size as the input
# image, (using an extra dimension for the alpha transparency),
# then add the watermark to the overlay in the bottom-right
# corner
overlay = np.zeros((h, w, 4), dtype="uint8")
overlay[h - wH - 10 : h - 10, w - wW - 10 : w - 10] = watermark
# blend the two images together using transparent overlays
output = image.copy()
cv2.addWeighted(overlay, 1, output, 1, 0, output)
cv2.imshow("output", output)
cv2.waitKey(0)
cv2.waitKey(0)
Watermark
Image
Good Output
I'm looking to get something like this (this was done with ps, should be possible with programming though)
there is no transparency in opencv; an image processing lib. Opencv is not photoshop If you want to simulate transparency you must use addweighted
@LBerger I'm using addWeighted and I can get transparency just that I can't get it the way I wanted.
I will add a result to show what output I get