数字水印|Arnold变换的Python代码实现(灰度图版)
发布时间
阅读量:
阅读量

将彩色图像转化为灰度图像,并实施 \mathsf{Arnold} 置乱处理及其逆过程。
import cv2
import numpy as np
from matplotlib import pyplot as plt
def arnold(img, shuffle_times, a, b):
r, c, d = img.shape
img = img[:, :, 0]
p = np.zeros((r, c), np.uint8)
for s in range(shuffle_times):
for i in range(r):
for j in range(c):
x = (i + b * j) % r
y = (a * i + (a * b + 1) * j) % c
p[x, y] = img[i, j]
img =
全部评论 (0)
还没有任何评论哟~
