LSB steganography (text in image)
Ältere Kommentare anzeigen
hello, can anyone help me to retrieve the text data from the watermarked image. Am obtaining the binary values of the text ie hidden.
f=imread('C:\Users\Bhavana\Desktop\satya\rvce_2012-14\imp\tech sem data\exeprgmas\original.png');
[visibleRows visibleColumns numberOfColorChannels] = size(f);
figure(1);
subplot(2,2,1);
imshow(f);
title('original image');
[m,n]=size(f);
[pixelCount grayLevels] = imhist(f);
subplot(2,2,2);
bar(pixelCount);
title('histogram of original image');
fid = fopen('C:\Users\Bhavana\Desktop\satya\rvce_2012-14\2sem seminar\seminar\REF\SIGNALS\watermark\q.txt');
x=fread(fid,'*char');
d=size(x);
binary = dec2bin(x);
binary_t=transpose(binary);
bin=binary-'0';
bb=padarray(bin,[27,137]);
[hiddenRows hiddenColumns numberOfColorChannels] = size(bb);
% Tile the hiddendata, if it's smaller, so that it will cover the original image.
if hiddenRows < visibleRows || hiddenColumns < visibleColumns
watermark = zeros(size(bb));
for column = 1:visibleColumns
for row = 1:visibleRows
watermark(row, column) = bb(mod(row,hiddenRows)+1, mod(column,hiddenColumns)+1);
end
end
watermark = watermark(1:visibleRows, 1:visibleColumns);
else
% Watermark is the same size as the original image.
watermark = f;
end
bit=1;
for column = 1: visibleColumns
for row = 1:visibleRows
watermarkedImage(row,column)=bitset(f(row,column), bit, watermark(row, column));
end
end
subplot(2,2,3);
imshow(watermarkedImage);
title('watermarked image');
[pixelCount grayLevels] = imhist(watermarkedImage);
subplot(2,2,4);
bar(pixelCount);
title('histogram of watermarked image');
recoveredWatermark = zeros(size(watermarkedImage));
for column = 1:visibleColumns
for row = 1:visibleRows
recoveredWatermark(row, column) = bitget(watermarkedImage(row, column), bit);
end
end
% Scale the recovered watermark to 0=255
recoveredWatermark = uint8(1 * recoveredWatermark);
Antworten (1)
Walter Roberson
am 8 Apr. 2014
0 Stimmen
Add '0' to the binary values, char() the result, use bin2dec(), char() the result to get the text.
Kategorien
Mehr zu Watermarking finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!