我正在从事隐写术项目。不使用PIL 我已经将封面图片复制到另一个变量中 将封面图像分成块 在方块上做了一些操作 现在,我想从块中的对应像素替换封面图像的每个像素 最后,显示图片
img = imread('Lena.jpg') # cover image
row ,col = img.shape
imgx = img[:]
blocksize = 3
block=[]
block = divideintoblocks()# size of each block 3*3
#total 171*171 blocks of 3*3 for a 513*513 image
bcnt = 0 # number of block count
for block in blocks:
for i in range(r):
for j in range(c):
px = bcnt / numberOfBlocks # finding row of corresponding block
py = bcnt % numberOfBlocks # finding col of correspondong block
imgx[px * blocksize +i ][ py * blocksize + j] = block[i][j]
bcnt+=1