详细叙述看上一篇:基于Arnold变换的图像置乱-Python实现
这里只贴代码和图片
ARNOLD置乱:
M = 256
AN = numpy.zeros([256,256])
BN = im_data
BN = img_as_float(BN)
BN = img_as_float(BN)
n = 2
a = 3
b = 5
N = 256
for i in range(1,2):
for y in range(16):
y = y*16
for x in range(16):
x = x*16
#print(x,y)
xx = (x+b*y)%256
yy = ((a*x)+(a*b+1)*y)%256
#print(BN[y][x])
for ii in range(16):
for jj in range(16):
AN[yy+ii][xx+jj] =BN[y+ii][x+jj]
#print(BN[y+jj][x+jj])