matlab - steganography using DFT -
i have problem getting image after hiding it, converted hidden image to
dct cannot back, cannot find problem in code:
a=imread('e:\sofia1.jpg'); m=imread('e:\mandrill.jpg'); [ax b]=size(a); [cl d]=size(m); a=imresize(a,[250 250]); m=imresize(m,[250 250]); a=a(:,:,1); m=m(:,:,1); mf=fft2(m); mfbw=im2bw(real(mf)); steg=a+uint8((mfbw)); %hiding image mfbw in image m=bitget(steg,1); %retrieving data h=fspecial('gaussian'); [c,d]=size(h); hp=freqz2(h,size(mfbw,2),size(mfbw,1)); hps=ifftshift(hp); g=hps.*mfbw; % product of transfer function , image in frequency domain g=real(ifft2(g)); imshow(g) i=mat2gray(g); imshow(i)
if want use dct, may dct2
, instead of taking real part fft2, because it's faster , more straightforward.
regarding question, crucial problem.
mfbw=im2bw(real(mf));
this creates binary image of dct coefficients. means values either 0 or 1. a binary image of dct coefficients has pretty no relation original image, m
, looks like.
a less major, still important flaw in following line.
steg=a+uint8((mfbw)); %hiding image mfbw in image
you add these binary values cover image. example, if least significant bit (lsb) of pixel in 1 , add 1 mfbw
, bit change 0 (with carry flag next bit). want substitute lsb of pixels in 0s , 1s. done following command:
steg=bitset(a,1,mfbw);
but remember, information embed nonsense.
final thought: seem misunderstand steganography in frequency domain means. transform cover image frequency domain, hide secret there , convert spatial domain. dct specifically, cover image split in 8x8 blocks, transformed individually.
Comments
Post a Comment