1

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): image

and I generated mask:

mask

And I would like to have, the object with smooth mask gradient like did in photoshop: 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.

enter image description here

konradns
  • 57
  • 8

0 Answers0