About the alpha channel

can you just please tell how the glasses are overlayed on the image in this snippet–>
for i in range(glass.shape[0]):
for j in range(glass.shape[1]):
if(glass[i,j,3]>0):
img[y+i,x+j,:]=glass[i,j,:-1]

i checked out some blog over it but all they said was the meaning,and to implement it using addweighted function, please explain about this also

Hey,
Your original image is 3dimn image, glasses are 4 dimn img. This code means check the 4th layer of glasses image, if it is greater than 0 (i.e if the pixel have some opacity … 0 means no opacity) Then replace first 3 Pixels of that position in the original image…
Therefore img[y+i,x+j,:]=glass[i,j,:-1] img has all there channels, whereas we are not considering (4th) last channel of glass image.

Alternate option is to use addweighted() function provided in opnecv Does the same work. You need to check the documentation how to call that function

Thanks :slight_smile: