我正在尝试使用 LSB 进行隐写术,但我得到了带有很多黑色像素的图像,我正在替换 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'),