def lsb_decode(image):
try:
red, green, blue = image.split()
watermark = ImageMath.eval("(a&0x1)*0x01", a=red)
watermark = watermark.convert('L')
watermark_bytes = bytes(watermark.getdata())
watermark_bits_array = np.fromiter(watermark_bytes, dtype=np.uint8)
watermark_bytes_array = np.packbits(watermark_bits_array)
watermark_bytes = bytes(watermark_bytes_array)
bytes_io = BytesIO(watermark_bytes)
return load(bytes_io)
except UnpicklingError:
return ''
评论列表
文章目录