这个matlab的程序运行不出? 10
%%%%%arnold置乱%%%%%%%%%%%%以下程序用于计算置乱周期%%%%%%x=1;%y=1;%t=1;%m=64;%%%%图片的高宽size%d=x;x=x+...
%%%%%arnold置乱%%%%%
%%%%%%%以下程序用于计算置乱周期%%%%%
%x=1;
%y=1;
%t=1;
%m=64;%%%%图片的高宽size
%d=x; x=x+y; y=d+2*y;
%while (x~=1&y~=1)
%t=t+1;
%if x>m;
% x=mod(x,m);
%end
%if y>m;
%y=mod(y,m);
%end
%d=x; x=x+y;y=d+2*y;
%end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function pic1=arnold_zhiluan(pic)
times=14;
%pic=imread('dchm.bmp');
[l1,l2]=size(pic);
pic1=zeros(l1,l2);
out=zeros(l1,l2);
if l1~=l2
error('图片不是方阵');
end
pic1=pic;
for i=1:times
for j=1:l1
for k=1:l2
temp=pic1(j,k);
a1=mod((j-1)+(k-1),l1)+1; %新像素行位置
a2=mod((j-1)+2*(k-1),l2)+1;%新像素列位置
out(a1,a2)=temp;
end
end
pic1=out;
end 展开
%%%%%%%以下程序用于计算置乱周期%%%%%
%x=1;
%y=1;
%t=1;
%m=64;%%%%图片的高宽size
%d=x; x=x+y; y=d+2*y;
%while (x~=1&y~=1)
%t=t+1;
%if x>m;
% x=mod(x,m);
%end
%if y>m;
%y=mod(y,m);
%end
%d=x; x=x+y;y=d+2*y;
%end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function pic1=arnold_zhiluan(pic)
times=14;
%pic=imread('dchm.bmp');
[l1,l2]=size(pic);
pic1=zeros(l1,l2);
out=zeros(l1,l2);
if l1~=l2
error('图片不是方阵');
end
pic1=pic;
for i=1:times
for j=1:l1
for k=1:l2
temp=pic1(j,k);
a1=mod((j-1)+(k-1),l1)+1; %新像素行位置
a2=mod((j-1)+2*(k-1),l2)+1;%新像素列位置
out(a1,a2)=temp;
end
end
pic1=out;
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询