資源簡介
對隱藏的圖片矩陣的隱藏那一層對應(yīng)的二維矩陣進(jìn)行左移四位操作,得到對應(yīng)提取圖像的矩陣,進(jìn)行矩陣轉(zhuǎn)化為對應(yīng)圖片輸出。
代碼片段和文件信息
#Writen?by??Liuchang
from?PIL?import?Image
import?numpy?as?np
import?matplotlib.pyplot?as?plt
import?matplotlib.image?as?mpimg
def?secretCover(count):
????cover?=?Image.open(‘C:/Users/user/Desktop/picture1.bmp‘)
????secret?=?Image.open(‘C:/Users/user/Desktop/picture2.bmp‘)
????secretCopy?=?Image.open(‘C:/Users/user/Desktop/picture2.bmp‘).convert(‘L‘)
????secretMatrix?=?np.array(secretCopy)
????coverMatrix?=?np.array(cover)
????row?col?=?secretMatrix.shape
????for?i?in?range(row?-?1):
?????????for?j?in?range(col?-?1):
?????????????coverMatrix[i?j?count]?=?coverMatrix[i?j?count]?&?240
?????????????secretMatrix[i?j]?=?secretMatrix[i?j]?>>?4
?????????????coverMatrix[i?j?count]?=?coverMatrix[i?j?count]?|?secretMatrix[i?j]
???
評論
共有 條評論