라벨이 alpha channel인 게시물 표시

Image Processing #5 - WaterMark using alpha channel

이미지
In the previous article, we saw how to implement a watermark without an alpha channel. This method uses a method of overlaying the part where the color exists except for the black color (0,0,0) part of the mask image. However, in the case of a png file having an alpha channel, this can be simplified because the density can be adjusted by the size of the alpha channel value. The source you implement is almost the same as the existing one. However, if the existing code finds black, this time, read the alpha channel value and divide it by 255 to reflect this ratio. New watermark function using alpha channel def process_alpha_masking (base, mask, pos): h, w, c = mask . shape hb, wb, _ = base . shape x = pos[ 0 ] y = pos[ 1 ] #check mask position if (x > wb or y > hb): print( ' invalid overlay position(%d,%d)' % (x, y)) return None #alpha channel check if c != 4 : print...