求助!高手帮帮忙
i=imread('math.bmp');
i=imread('math.bmp');
i1=rgb2gray(i);%i1灰度图像
imwrite(i1,'mathh.bmp'); %以上程序是用来产生40X40的图像
ff=imread('cameraman.tif');
A = imread('mathh.bmp');
[r,c] = size(A);
bit=8;
bitplan=zeros(r,c,bit);
for i01=1:bit;
bitplan(:,:,i01)=bitget(A,i01);
end %灰度图像的位图分解
bc11=bitplan(:,:,1);
bc12=bitplan(:,:,2);
bc13=bitplan(:,:,3);
bc14=bitplan(:,:,4);
bc15=bitplan(:,:,5);
bc16=bitplan(:,:,6);
bc17=bitplan(:,:,7);
bc18=bitplan(:,:,8);
%disp(bc18); %某一位平面是由1和0组成的二值数据
[ff8]=qianru(bc18,ff);
[ff7]=qianru(bc17,ff);
[ff6]=qianru(bc16,ff);
[ff5]=qianru(bc15,ff);
[ff4]=qianru(bc14,ff);
[ff3]=qianru(bc13,ff);
[ff2]=qianru(bc12,ff);
[ff1]=qianru(bc11,ff);%得到嵌入秘密信息的8个载体图像
[bc21]=tiqu(ff1);
[bc22]=tiqu(ff2);
[bc23]=tiqu(ff3);
[bc24]=tiqu(ff4);
[bc25]=tiqu(ff5);
[bc26]=tiqu(ff6);
[bc27]=tiqu(ff7);
[bc28]=tiqu(ff8);
bc31=bc21;
bc32=bitshift(bc22,1);
bc33=bitshift(bc23,2);
bc34=bitshift(bc24,3);
bc35=bitshift(bc25,4);
bc36=bitshift(bc26,5);
bc37=bitshift(bc27,6);
bc38=bitshift(bc28,7); %对提取后的二值图像进行左移位
bbb=bitor(bc31,bc32);
bbb=bitor(bbb,bc33);
bbb=bitor(bbb,bc34);
bbb=bitor(bbb,bc35);
bbb=bitor(bbb,bc36);
bbb=bitor(bbb,bc37);
bbb=bitor(bbb,bc38); %经过bitor函数后的得到bbb
if bbb==A
imwrite(bc18,'ca18.tif')
end %用来判断bbb和A是否相等,相等则产生一张‘ca1.tif’的图像
subplot(2,2, 1); imshow(A);title('原始秘密图像');
subplot(2,2, 2); imshow(ff);title('原始载体图像');
subplot(2,2, 3); imshow(ff8);title('嵌入秘密信息后的载体图像');
subplot(2,2, 4); imshow(bbb/256);title('提取出来的图像');
A1=double(A);
A1 = A1- mean2(A1);
bbb = bbb - mean2(bbb);
r01=A1.*bbb;
r02=sum(r01);
r1 = sum(sum(r02));
r2=sqrt(sum(sum(A1.*A1))*sum(sum(bbb.*bbb)));
r=r1/r2;
disp(r)
嵌入算法子程序:
function [f1]=qianru(b,bb)
w=b;
f=bb;
f1=f;
for i=1:40
for j=1:40
x0=i;
y0=j;
for k=1:50 %迭代次数为50次
x=x0+33*y0;
y=3*x0+100*y0; %产生arnold映射
if x>256
x=mod(x,256);
end;
if y>256
y=mod(y,256);
end;
if x==0
x=256;
end;
if y==0
y=256;
end; %确保x,y在255内
end; %确定秘密信息嵌入位置
g=f(x,y);
c=bitget(g,8:-1:1); %求出位于(x,y)的八位二进制
z(1)=0.40001;
for n=1:500
z(n+1)=4*z(n)-4*z(n)^2;
end;
if z(n+1)<0.25
k=2;
elseif z(n+1)<0.55
k=3;
elseif z(n+1)<0.85
k=4;
elseif z(n+1)<0.98
k=5;
else k=6;
end;
bk=c(1,k); %求出第k位f(x,y)的值
if bk==w(i,j)
f1(x,y)=f(x,y);
else
for t=1:64
f11(x,y)=f(x,y)+t;
f12(x,y)=f(x,y)-t;
d11=bitget(f11(x,y),8:-1:1);
bk11=d11(1,k);
d12=bitget(f(x,y),8:-1:1);
bk12=d12(1,k);
if bk11==w(i,j)
f1(x,y)=f11(x,y);
elseif bk12==w(i,j)
f1(x,y)=f12(x,y);
end;
end;
end;
end;
end;
imwrite(f1,'cameraman04.tif')
提取算法子程序:
function [w2]=qianru(cc)
f2=cc;
w2=zeros(40);
for i=1:40
for j=1:40
x0=i;
y0=j;
for k=1:50 %迭代次数为50次
x=x0+33*y0;
y=3*x0+100*y0; %产生arnold映射
if x>256
x=mod(x,256);
end;
if y>256
y=mod(y,256);
end;
if x==0
x=256;
end;
if y==0
y=256;
end; %确保x,y在255内
end; %确定秘密信息嵌入位置
g2=f2(x,y);
c2=bitget(g2,8:-1:1);
z(1)=0.40001;
for n=1:500
z(n+1)=4*z(n)-4*z(n)^2;
end;
if z(n+1)<0.25
k=2;
elseif z(n+1)<0.55
k=3;
elseif z(n+1)<0.85
k=4;
elseif z(n+1)<0.98
k=5;
else k=6;
end;
bk2=c2(1,k);
w2(i,j)=bk2;
end;
end;
把这个MatLab程序用C语言编出来!急用!谢谢!