Stegnaography using DCT

19 visualizaciones (últimos 30 días)
Pranoy
Pranoy el 29 de En. de 2012
Comentada: Ajmal Mohammed V M el 13 de Mayo de 2022
this is the code we are using to implement steganography based on DCT....
I = imread('lena_std.jpg');
I = im2double(I(:,:,1));
I2=imread('test.bmp');
subplot(2,2,1),imshow(I);
subplot(2,2,2),imshow(I2);
I2=de2bi(I2(:,:,1));
x=reshape(I2',1,38400);
T = dctmtx(8);
dct = @(x)T * x * T';
B = blkproc(I,[8 8],dct);
k=0;
for i=1:256
for j=1:256
if B(i,j)>0
b=dec2bin(typecast(single(B(i,j)),'uint32'),32);
b(1,7:8)=x(1,k*2+1:k*2+2);
k=k+1;
c=double(typecast(uint32(bin2dec(b)),'single') );
B(i,j)=c;
end
end
end
subplot(2,2,3),imshow(B);
invdct = @(x)T' * x * T;
B3= blkproc(B,[2 2],invdct);
subplot(2,2,4),imshow(B3);
could somebody tell me the problem in this code with respect to the binary and decimal conversion....
  2 comentarios
kbae
kbae el 26 de Abr. de 2013
could you give me the extraction code for this embedding method?thank you
Ajmal Mohammed V M
Ajmal Mohammed V M el 13 de Mayo de 2022
Could u pls share the extraction code for the above problem

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de En. de 2012
You will find that de2bi() does not return the characters '0' and '1' that are required for bin2dec().
You will also find that the bit ordering is different between de2bi() and dec2bin(). Compare
dec2bin(8,5)
de2bi(8,5)
  2 comentarios
Pranoy
Pranoy el 31 de En. de 2012
ya...so how do i convert my payload image to binary to embed it in the cover image??
Walter Roberson
Walter Roberson el 31 de En. de 2012
Mostly, be consistent about whether you use de2bi() or dec2bin()

Iniciar sesión para comentar.

Más respuestas (5)

NILANJ
NILANJ el 19 de Abr. de 2013
I2=de2bi(I2(:,:,1)); can any one tell me plz that in this function why (:,:,1) ???
  1 comentario
Walter Roberson
Walter Roberson el 19 de Abr. de 2013
First bit plane -- corresponding to Red in an RGB image.

Iniciar sesión para comentar.


Maulana Wahid
Maulana Wahid el 9 de En. de 2014
could you please explain your DCT code step by step?

Peter Eze
Peter Eze el 22 de Dic. de 2016
use transpose(dec2bin(ImageMessage(i,j))) to create the binary string for each pixel of the message to be embedded

juhi patel
juhi patel el 26 de Sept. de 2017
de2bi()is used for you want your data in matrix form.&dec2bin() is used if you want output in string format.you are mixing both function in this code.using de2bi() will solve your problem since image is in matrix form.
  1 comentario
Walter Roberson
Walter Roberson el 26 de Sept. de 2017
I almost always use dec2bin() and subtract '0' to get matrix form. Then I do not have to worry about the fact that de2bi() is part of a communications toolbox rather than part of basic MATLAB.

Iniciar sesión para comentar.


Fady Samann
Fady Samann el 13 de Jun. de 2020
Editada: Fady Samann el 12 de Ag. de 2020
First, you are not doing quantization to remove the samller DCT coefficients after that you can change LSB by masking it and and OR it with the message bit. Use bitwise operations, because dec2bin and bin2dec treat the binary as a string of 0's and 1's.
the process is just like JPG compression but in the middle of quantization and dequantization, you can change the LSB.
Second, when you pick the right DCT coefficient to change its LSB, the coefficient must be greater than one because of changing the LSB of one to zero (from the message bits) will set the coefficient to zero then during the decoding process this coefficient will be skipped because of the if condition (B(i,j)>0).
Note: round the number only after the quantization stage in the encoding and decoding of the message.

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by