function chaoticDemoForPixarShift
%使用混沌序列加密位图
%生成一个混沌序列
%根据该序列对要加密图像的像素值进行循环移位操作
%模拟发现,该加密没有太大的实际意义,因为仅仅是在左右,上下循环移动,
%无论移动多少次,都和移动两次,即左右上次各一次没有差别
%考虑改进:
%方案A:对每个像素值的二进制位进行循环移位
%方案B:对整体的像素采用置乱移位
%方案C:水平移位的过程中,移位只保持某一行进行循环移位,
% 垂直移位的过程中,移位只保持某一列进行循环移位,
%程序设计:李立宗
%2012年3月3日
% http://blog.csdn.net/superdont
% lilizong【at】Gmail
clear;
clc;
[filename pathname]=uigetfile('*.bmp;*.tiff;*.tif', '读入图像');
os=[pathname filename];
%os原始图像的路径
o=imread(os);
% figure,imshow(o);
%计算原始图像的大小
[m n]=size(o);
key1=512;
key2=256;
l=zeros(1,key1);
bl=zeros(1,key1);
l(1)=0.539;
for i=2:key1
l(i)=1-2*l(i-1)*l(i-1);
bl(i)=rem(round(l(i)*100000),key1);
end
for i=1:key1
if bl(i)==0
bl(i)=bl(i)+1
end
end
os=o;
for i=1:2:key1
% i
os=circshift(os,[bl(i) bl(i+1)]);
[bl(i) bl(i+1)]
% subplot(2,2,(i+1)/2),imshow(os);
% imshow(os);
end
figure,
subplot(1,2,1),imshow(o),title('原始图像');
subplot(1,2,2),imshow(os,[]),title('加密图像');
% subplot(1,3,3),imshow(or,[]),title('解密图像');