python | 去除圖片馬賽克

馬賽克

大家在網上發圖時,一般情況下,大家可能都會使用馬賽克來遮蓋圖片上的敏感資訊。比如身份證號、姓名、地址,用馬賽克掩蓋後,就能有效達到保護資訊保安的目的。但是,隨著影象AI的進步,現在打碼也不再安全[狗頭]

Depix

其實在Depix出現之前,已經有很多號稱可以去碼的軟體和專案出現,然而結果卻都不盡如人意。首先在這裡展示一下Depix的效果圖。

圖一是打過碼的圖片,圖二是去碼之後的圖片。結果如何,看看便知。

python | 去除圖片馬賽克

python | 去除圖片馬賽克

專案詳情

GitHub地址

https://github。com/beurtschipper/Depix

下載

git clone https://github。com/beurtschipper/Depix。git

使用

Cut out the pixelated blocks from the screenshot as a single rectangle。Paste a De Bruijn sequence with expected characters in an editor with the same font settings (text size, font, color, hsl)。Make a screenshot of the sequence。 If possible, use the same screenshot tool that was used to create the pixelized image。Run python depix。py -p [pixelated rectangle image] -s [search sequence image] -o output。png

舉例(命令列)

python depix。py -p images/testimages/testimage3_pixels。png -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced。png -o output。png

最後

建議大家,基於安全考慮,請不要使用馬賽克,最佳做法是直接將需要遮擋的區域使用黑條或者白條覆蓋,這樣是無法透過演算法還原的。