Clear Filters
Clear Filters

I have this code of embed and extract texte data into an image using DWT watermark technique with matlab .I need the know algorithm used for this code to embed a text,extract them and the steps thats used to embed and extract data,explanation of code

2 views (last 30 days)
Data Embedding: coverImage = imread('lena.bmp'); message = importdata('minutiaTest.txt'); %message = 'Bifurcations:';
[LL,LH,HL,HH] = dwt2(coverImage,'haar'); if size(message) > size(coverImage,1) * size(coverImage,2) error ('message too big to embed'); end
bit_count = 0; steg_coeffs = [4, 4.75, 5.5, 6.25, 7];
for jj=1:size(message,2)+1 if jj > size(message,2) charbits = [0,0,0,0,0,0,0,0]; else charbits = dec2bin(message(jj),8)'; charbits = charbits(:)'-'0'; end for ii=1:8 bit_count = bit_count + 1;
if charbits(ii) == 1
if HH(bit_count) <= 0
HH(bit_count) = steg_coeffs(randi(numel(steg_coeffs)));
end
else
if HH(bit_count) >= 0
HH(bit_count) = -1 * steg_coeffs(randi(numel(steg_coeffs)));
end
end
end
end
stego_image = idwt2(LL,LH,HL,HH,'haar'); imwrite(uint8(stego_image),'newStego.bmp'); Data Extraction: new_Stego = imread('newStego.bmp'); [LL,LH,HL,HH] = dwt2(new_Stego,'haar'); message = ''; msgbits = ''; for ii = 1:size(HH,1)*size(HH,2) if HH(ii) > 0 msgbits = strcat (msgbits, '1'); elseif HH(ii) < 0 msgbits = strcat (msgbits, '0'); else return; end
if mod(ii,8) == 0
msgChar = bin2dec(msgbits);
if msgChar == 0
break;
end
msgChar = char (msgChar);
message = [message msgChar];
msgbits = '';
end
end

Answers (0)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!