算法1.把图像的数据重塑成一维的形式,对其进行置乱;clear?close???clc??G=imread(F:\Fatiao.jpg);??G=rgb2gray(G)subplot(1,3,1);??imshow(G);???title(原图);??A=G(:);????A1=G(end: :1);乱?subplot(1,3,2);?A1=reshape(A1,256,256)imshow(A1);??title(一维置乱);??%title一下?A2=A1(end:-1:1);?A2G=reshape(A2,256,256);?subplot(1,3,3)?;imshow(A2G)?? title(置乱恢复);??%title一下?算法2.把图像看成二维的形式,采用二维坐标的形式对其进行置乱;clear?close?clc??G=imread(F:\Fatiao.jpg); G=rgb2gray(G)subplot(1,3,1);?imshow(G);? title(原图)?%title一下原图Gadd=fix(256*rand(256,256)); for?i=1:256???????for?j=1:256??????????G1(i,j)=0.1*G(i,j)+0.9*Gadd(i,j);? ?????en
原创力文档

文档评论(0)