1,Cat Map思想
p,q分别为控制参数;SP是图像的大小;SB是块的大小,一般为4;
通过一个CatMap映射置乱矢量量化块的位置。
2,matlab代码实现
%%ArnoldMap映射 输入一个128*128矩阵,输出128*128矩阵
function imgn = ArnoldMap(index_image)
%index_image=reshape(block_index,m/Kbook_size,n/Kbook_size);
%置乱index_image中数的位置,即置乱VQ矢量量化图像 块的位置;
%读取index_image中的每一个数及其位置,根据Cat Map计算每个数新的位置,组成新的矩阵
%将index_image 128*128 重塑成新的矩阵 类似 block_index 16384 ,接下来继续重塑矩阵 类似block_kpixel 16*16384
%根据VQ.m中恢复图像的方法,恢复置乱块位置后的图像。
%已实现使用Arnold映射 置乱矢量量化图像块的位置
[h,w]=size(index_image);
%h,w用参数的形式表示
img=index_image;
%置乱与复原的共同参数,就相当于密码,有了这几个参数,图片就可以复原
n2=20;%迭代次数
a=3;b=5;
N=h;%N代表图像宽高,宽高要一样
%置乱操作
imgn=zeros(h,w);
for i=1:n2
for y=1:h
for x=1:w
xx=mod((x-1)+b*(y-1),N)+1; %mod(a,b)就是a除以b的余数
yy=mod(a*(x-1)+(a*b+1)*(y-1),N)+1;
imgn(yy,xx)=img(y,x);
end
end
img=imgn;
end
%%将矢量量化图像、Cat Map置乱图像和Cat Map置乱复原图像放在一张figure
% figure(4);
% subplot(121);
% imshow(I_qu)
% title('矢量量化图像');
% subplot(122);
% imshow(qu1)
% title('Cat Map置乱图像');
% figure(4);
% subplot(131);
% imshow(I_qu)
% title('矢量量化图像');
% subplot(132);
% imshow(qu1)
% title('Cat Map置乱图像');
% subplot(133);
% imshow(qu2)
% title('Cat Map置乱复原图像');
end
3,CatMap置乱复原
CatMap置乱复原是逆过程,下篇文章详细叙述