我正在尝试使用LSB进行隐写术,但我得到了大量黑色像素的图像 iam替换DCT值小于零的覆盖图像像素中的LSB 我不知道为什么我的图像中有黑色像素
% read cover image
C=imread('E:\sofia1.jpg');
% read Secret image
S=imread('E:\mandrill.jpg');
C=C(:,:,1);
S=S(:,:,1);
[r1 c1]=size(C);
CDCT=dct2(C);
CDCTR= real(CDCT);
for i=1:r1
for j=1:c1
%CDCTR(i,j)
if(CDCTR(i,j)<0)
b=bitget(S(i,j),8);
%disp(b)
x=bitset(C(i,j),1,b); % replace LSB in cover image with MSB in
C(i,j)=x;
TM(i,j)=1; % put 1 in the trace mmatrix when successful repalce
else
TM(i,j)=0; % put 0 in the trace matrix when no replace
end
end
end
%Retreive again the Secret image from the covered image
n=1;
for i=1: r1
for j=1:c1
if(TM(i,j)==1)
b=bitget(C(i,j),1);
E(i,j)=b; %bitset(E(i,j),8,b) ;
%else
%E(i,j)=;
end
end
end
figure(5), imshow(mat2gray(E)),title('Extracted Secret Image'),