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

📄 signed_mat2dceb.m

📁 基于图象的数据隐写和提取matlab代码
💻 M
字号:
function B=signed_mat2DCEB(N,t);%This takes a picture matrix of magnitudes N and a threshold t the%matrix is then broken up into 8x8 tiles then transformed using the DCT%the results are rounded for a slight quantitization.%this method does not give exact compression ratios, but the compression%occurs more in the less significant frequencies rather than across the%entire range of coefficents%here the "dropped coefficents" are temporarily set to 1 with the same%sign they orignally had. This marks them for replacement with data using%the zeros hiding method%%%Please input a square matrix that has multiple of 8 dimensions[x dnk]=size(N);x1=x/8;tiled=zeros(8,8,x1,x1);q=qmat();%break up the matrix into 8x8 tiles and quantizefor i=1:x1    for j=1:x1        tiled(:,:,i,j)=round(dct2(N(8*i-7:i*8,8*j-7:j*8)));    endend%marks coefficients at or below the threshold value with a one%it keeps the sign of the original coefficent so that the zeros%data will won't be as noticiable[dnk dnk x x]=size(tiled);keeps= x^2*8^2;drops=0;for i=1:x    for j=1:x        for m=1:8            for n=1:8                if (abs(tiled(m,n,i,j))<=t && abs(tiled(m,n,i,j))>0)                    if(tiled(m,n,i,j)>0)                        tiled(m,n,i,j)=1;                    else                        tiled(m,n,i,j)=-1;                    end                        drops=drops+1;                                    end            end        end    endendkeeps=keeps-drops;sprintf('drops=%d',drops)sprintf('keeps=%d',keeps)B=tiled;

⌨️ 快捷键说明

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