⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yuyinxinghao.rar.txt

📁 隐藏语音信号 信息隐藏于1994年的国际图像处理会议上(ICIP)正式提出,它通过信号处理的方法将隐藏信息嵌入到宿主(声音、图像、视频和文档等)中
💻 TXT
字号:
实验代码:
function rfractal
clear
%????????????clear
clc
%????????????
sound=wavread('F:\V.wav');%?????[-1,1],?????22.05k
count1=length(sound);
t=[0:count1-1];
figure(1)
subplot(3,1,1)
stem(t,sound)
title('The original sound');
axis([0 count1 -1 1]);
 
%??????
%xx=enframe(xx,256,256);
xppl=length(sound);
j=1;
zhenc=256;
zheny=256;
zhens=floor(xppl/256);
for i=1:zheny:xppl-zhenc;
    xx1(j,:)=sound(i:i+zhenc-1)';
    j=j+1;
end
sound0=xx1; %???????????????????????????256?
 
%?????
%????
dudi=sound0.^2;
for k=1:j-1
kk=sum(dudi(k,:));
ddh(k)=kk;  %ddh?sound??????????????????
end
maxd=max(ddh);
count2=length(ddh);
t1=[0:zheny:(count2-1)*zheny];
subplot(3,1,2)
plot(t1,ddh)
axis([0 count1-1 0 1.4]);
 
for l=1:count2
    if ddh(l)>=0.8*maxd   %?????????
        m=l;        % m?????????sound??m???????
        break;
    end
end
m;
for L=m:count2
    if ddh(L)<0.8*maxd   %?????????
        M=L;        % m?????????sound??m???????
        break;
    end
end
M;
j=1;
for n=m:M
   xx2(j,:)=sound0(n,:);
   ddh1(j)=ddh(n);
   j=j+1;
end
sound0=xx2; %???????????????
 
countt3=zheny*(m-1);
count3=countt3+1;
countt33=zheny*M;
sound1=sound(count3:countt33);
count4=length(sound1);
tt=[0:count4-1];
subplot(3,1,3)
stem(tt,sound1)
axis([0 count1 -1 1]);
%axis([0 count1-1 -0.4 0.4]);
 
size(sound0)
soundc=sound0';
t=[0:256*(j-1)-1];
rj=j;
Ss=reshape(soundc,1,256*(j-1));
figure(2)
subplot(3,1,1)
%stem(t,Ss)
plot(t,Ss)
title('The signal after dection')
axis([0  256*(j-1)-1  -2  2])
 
%????
jj=j-1;
%W=hamming(256);
%W=W';
%for i=1:jj
    %xx3(i,:)=sound0(i,:).*W;
%end
sound00=sound0; %sound00??????????
 
 
 
for i=1:jj
         [C,L]=wavedec(sound00(i,:),1,'db1');
         cfs(i,:)=appcoef(C,L,'db1');
         cfh(i,:)=detcoef(C,L);
end
%*******************************************************
%*******************************************************
rR=4;
for i=1:jj
       y(i,:)=dct(cfs(i,:));
        m(i)=max(y(i,:));
        n(i)=min(y(i,:));
        Dom(i)=m(i)-n(i);
        %Delta(i)=Dom(i)/16;
        Delta(i)=Dom(i)/2^(rR);
       % for j=1:17
        for j=1:2^(rR)
            T(i,j)=n(i)+Delta(i)*(j-1);
        end       
        
end
  %   the numberized area is 3,
  
 
 
% y is the DCT parameter of the low frequency of each frame
for i=1:jj
       py(i,:)=idct(y(i,:));
        c=[py(i,:) cfh(i,:)];
         psound(i,:)=waverec(c,L,'db1');
end
psound=psound';
Pr=reshape(psound,1,256*(rj-1));
 
pt=[0:256*(rj-1)-1];
 
%wavplay(Pr,8000);
 
%wavplay(sound1,8000);
 
         
%  The fraction dimension of the high frequency
for i=1:jj
    Ddel(i)=0;
    for j=1:127
        Ddel(i)=Ddel(i)+abs(cfh(i,j)-cfh(i,j+1));
    end
end
 
for i=1:jj
    D2del(i)=0;
    for j=1:63
        D2del(i)=D2del(i)+max([cfh(i,2*j-1),cfh(i,2*j),cfh(i,2*j+1)])-min([cfh(i,2*j-1),cfh(i,2*j),cfh(i,2*j+1)]);
    end
end
 
% The fracal dimention of the high frequency of each frame
for i=1:jj
   D(i)=1+log2(Ddel(i)/D2del(i));
end
%D
[P I]=min(D)
%[P I]=max(D)
% The minimun of the fracal dimention of the frame
 
% The numerize table is T the secret info is 1 2.3 2 0.9 -1.3 2,and insert
% into the 7th frame,Sect is the secret info
%Sect=[1 2.3 2 0.9 -1.3 2];
Sect=[5 2 7 6 3 1 6 0]
k=1;
while(k<length(Sect)+1)
          j=Sect(k)+1;  
          ecSect(k)=T(I,j);
          k=k+1;
end
       
 
T(I,:);
ecSect;
k=1;
     for i=5:10:(5+10*(length(Sect)-1))  % The position of the substitude in the 7 frame
         y(I,i)=ecSect(k);
         k=k+1;
     end
     
% add the renew DCT parameter here
% The IDCT of the renew DCT
for i=1:jj
   Dcfs(i,:)=idct(y(i,:));
end
 
 
 
% Use the cfs and cfh to reconstruct the wavelect here
for i=1:jj
     
        c=[Dcfs(i,:) cfh(i,:)];
         rsound(i,:)=waverec(c,L,'db1');
end
rsoundc=rsound';
Sr=reshape(rsoundc,1,256*(rj-1));  % The constructed signal
%wavplay(Sr,8000);
 
%*****************************************
%***************************************** Add the noise
yg = awgn(Sr,20,'measured');
ygg=awgn(Sr,20,'measured');
 
rt=[0:256*(rj-1)-1];
subplot(3,1,2)
plot(rt,Sr)
title('The info_inserted signal')
axis([0 256*(rj-1)-1 -2 2])
Ppr=Sr-Ss;
subplot(3,1,3)
plot(pt,Ppr)
title('The error- ori and infoin(min)')
axis([0 256*(rj-1)-1 -2 2])
%wavplay(Sr,8000);
%wavwrite(Sr,8000,'F:\308max');
figure(3)
subplot(3,1,1)
plot(rt,yg)
 
axis([0 256*(rj-1)-1 -2 2])
title('The transmission signal)')
cg=yg-Ss;
subplot(3,1,2)
plot(rt,cg)
title('The error-transignal and ori signal 30db');
axis([0 256*(rj-1)-1 -0.5 0.5])
 
cgg=ygg-Ss;
subplot(3,1,3)
plot(rt,cgg)
title('The error-transignal and ori signal 20db');
axis([0 256*(rj-1)-1 -0.5 0.5])
 
 
cyg=yg';
cSr=Sr';
Rs=reshape(cyg,256,jj);
Rs=Rs';
 
 
% The signal obtain the secret info can be devited into frames
for i=1:jj
   %  wpt=wpdec(sound00(i,:),1,'db2');
        % kk=2;
        % cfs(i,:)=wpcoef(wpt,[1 0]);  % The low frequency parameter
         %cfh(i,:)=wpcoef(wpt,[1 1]);  % The high frequancy parameter
         [C,L]=wavedec(Rs(i,:),1,'db1');
         rcfs(i,:)=appcoef(C,L,'db1');
         rcfh(i,:)=detcoef(C,L);
end
 
for i=1:jj
       ry(i,:)=dct(rcfs(i,:));
        m(i)=max(ry(i,:));
        n(i)=min(ry(i,:));
        Dom(i)=m(i)-n(i);
        Delta(i)=Dom(i)/2^(rR);
        %for j=1:17
        for j=1:2^(rR)
            rT(i,j)=n(i)+Delta(i)*(j-1);
        end       
        
end
 
% The numerized of the low frequency of the rebuild signal
 
%  The fraction dimension of  the high feeduency of the rebuild signal
for i=1:jj
    Ddel(i)=0;
    for j=1:127
        Ddel(i)=Ddel(i)+abs(rcfh(i,j)-rcfh(i,j+1));
    end
end
 
for i=1:jj
    D2del(i)=0;
    for j=1:63
        D2del(i)=D2del(i)+max([rcfh(i,2*j-1),rcfh(i,2*j),rcfh(i,2*j+1)])-min([rcfh(i,2*j-1),rcfh(i,2*j),rcfh(i,2*j+1)]);
    end
end
 
% The fracal dimention of the high frequency of each frame
for i=1:jj
   rD(i)=1+log2(Ddel(i)/D2del(i));
end
[rP rI]=min(rD)
%[rP rI]=max(rD)
rD;% The lowest value of the fracal dimention is 1.3612,which load in the 7th frame,Then according to the rule,we extract the number
    %  in the position of 5:10:65  
    k=1;
     for i=5:10:(5+10*(length(Sect)-1))  % The position of the substitude in the 7 frame
       rSect(k) =ry(rI,i);
         k=k+1;
     end
rSect
rT(I,:)
[Pp rPp]=size(rT);
    %********************
    %********************search the table reversely
    j=1;
    while (j<=length(rSect))
            k=1;
          flag=1;
          if(rSect(j)>=rT(I,rPp))
              rSect(j)=rPp-1;
          else
         % while(flag & k<16)
         while(flag & k<rPp)
             if (rSect(j)>=rT(I,k) & rSect(j)<rT(I,k+1))
               %rSect(j)=k-1; 
                if (abs(rSect(j)-rT(I,k))>abs(rSect(j)-rT(I,k+1)))
               rSect(j)=k;
               else
                rSect(j)=k-1; 
                end
               flag=0;
             else
               k=k+1;
              flag=1;
             end
         end
       
          end
          j=j+1;
     end
rSect
i=1;t=0;
while (i<=length(rSect))
   
    if (Sect(i)==rSect(i))
        t=t+1;
    end
    i=i+1;
end
per=t/length(rSect)
        
%Sect = 0.5585    2.1347    1.3466    0.5585   -1.8057    1.3466
 
%rSect = 0.5585    1.3466    1.3466    0.5585   -1.8057    1.3466
%Sect = 2.1347    0.5585   -1.0176    2.1347
%rSect =2.1347    0.5585   -1.0176    2.1347

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -