本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個(gè)人專欄
下載W3Cschool手機(jī)App,0基礎(chǔ)隨時(shí)隨地學(xué)編程>>戳此了解
導(dǎo)語
本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個(gè)人專欄
下載W3Cschool手機(jī)App,0基礎(chǔ)隨時(shí)隨地學(xué)編程>>戳此了解
利用Python簡(jiǎn)單實(shí)現(xiàn)圖片隱寫術(shù)。。。
或者說是水印技術(shù)。。。
說實(shí)話,真的只是簡(jiǎn)單實(shí)現(xiàn)。。。
沒什么技術(shù)含量。。。
可以說是入門級(jí)的隱寫術(shù)/水印技術(shù)。。。
Let's Go?
相關(guān)文件
百度網(wǎng)盤鏈接: https://pan.baidu.com/s/1DNVk11rMcFk9u-B7GE4Jow
密碼: 9ffy
開發(fā)工具
Python版本:3.5.4
相關(guān)模塊:
cv2模塊;
pillow模塊;
numpy模塊;
以及一些Python自帶的模塊。
環(huán)境搭建
安裝Python并添加到環(huán)境變量,pip安裝需要的相關(guān)模塊即可。
原理簡(jiǎn)介
相關(guān)文件中的源代碼主要實(shí)現(xiàn)了兩種水印技術(shù):
(1)空域數(shù)字水印
實(shí)現(xiàn)的是基于LSB的水印技術(shù)。。。
(2)頻域數(shù)字水印
實(shí)現(xiàn)的是基于FFT的水印技術(shù)。。。
T_T確實(shí)沒啥技術(shù)含量吧?
圖片需為PNG或BMP格式。。。
若頻域數(shù)字水印效果不佳,請(qǐng)修改alpha因子大小。
具體實(shí)現(xiàn)過程詳見源代碼。。。
使用演示
可直接運(yùn)行或作為模塊導(dǎo)入。
功能:

直接運(yùn)行方式:
在cmd窗口運(yùn)行Watermark.py即可。
演示一:基于FFT
載體圖片:

水印圖片:

嵌入效果:

解水?。?/strong>

演示二:基于LSB
載體圖片:

水印文字:
公眾號(hào):Charles的皮卡丘
嵌入效果:

解水?。?/span>

更多
上述內(nèi)容只是入門級(jí)的隱寫術(shù)/水印技術(shù)。。。
這是一項(xiàng)非常有趣的技術(shù)。。。
以后有機(jī)會(huì)會(huì)復(fù)現(xiàn)一些進(jìn)階版的水印算法。。。