def embed(self,ori_img, wm, key=10):
B = ori_img
if len(ori_img.shape ) > 2 :
img = cv2.cvtColor(ori_img, cv2.COLOR_BGR2YUV)
signature = BlindWatermark._gene_signature(wm,256,key).flatten()
B= img[:,:,0]
w,h = B.shape[:2]
if w< 64 or h <64 :
print('????????????? 64 pixel.?????????.')
return ori_img
if len(ori_img.shape ) > 2 :
img[:,:,0] = self.inner_embed(B,signature)
ori_img = cv2.cvtColor(img, cv2.COLOR_YUV2BGR)
else :
ori_img = B
return ori_img
评论列表
文章目录