I would like to apply gradient mask into png image with transparency in python openCv.
So I have an image like here (with transparency png):
and I generated mask:
And I would like to have, the object with smooth mask gradient like did in photoshop:
I tried to do it with:
def applyGradientToReflection(reflectionPath, gradientMask):
reflection_img = cv.imread(reflectionPath, cv.IMREAD_UNCHANGED)
gradientMask = cv.cvtColor(gradientMask, cv.COLOR_BGRA2GRAY)
gradientReflectionMask = cv.bitwise_and(reflection_img, reflection_img, mask=gradientMask)
return gradientReflectionMask
but with bitwise_and
it's binary without nice, smooth transition.