Sunteți pe pagina 1din 20

PROJECT REVIEW

Digital Watermarking and Steganography


BCI3005 (Slot : F2+TF2)

Submitted by

MAHTAB KAUR SAHI (16BCI0161)


DIVYANSHU NANDWANI (16BCI0127)
KUMOD ARYA (16BCI0172)
SIDDHARTH RAMRAKHIANI (16BCE0715)

on the topic

Implementing Watermarking in Images using DWT in Matlab

done under the guidance

of

Prof. Thenmozhi T
1. Abstract computerized frame. Applications
incorporate electronic publicizing,
continuous video and sound
Watermarking in images possesses conveyance, advanced vaults and
a wide range of applications in libraries, and Web distributing. In
today’s age of technology. any case, the vital inquiry that
emerges in these applications is the
information security. It has been
• Data authentication seen that current copyright laws are
• Fingerprinting not adequate for managing
• Broadcast monitoring advanced information.
• Owner identification Consequently the insurance and
• Copy protection requirement of protected innovation
• Medical applications rights for computerized media has
turned into a significant issue. This
The above listed applications are has prompted an enthusiasm
quite commonly used and are very towards growing new duplicate
relevant to the current digital prevention and assurance systems.
security methodologies. We would One such exertion that has been
like to implement statistically drawing in expanding interest
undetectable/invisible depends on advanced watermarking
watermarking as the first step of systems. As steganography give
learning how these applications are careful consideration towards the
carried out, so we are able to level of intangibility, watermarking
correctly understand where we pay the vast majority of its ascribes
stand currently in cyber security to the vigor of the message and its
methods and safety mechanisms. capacity to withstand assaults of
Studying the existing vulnerabilities evacuation, for example, picture
and can contribute to the field of tasks (revolution, trimming,
security by improving upon or separating) and so on in the event of
creating new methods to pictures being watermarked.
continuously progress in the Advanced watermarking is the way
grounds of security systems. toward installing data into
computerized sight and sound
substance with the end goal that the
2. Introduction data (which we call the watermark)
can later be removed or recognized
The headway of the Internet has for an assortment of purposes
brought about numerous new open including duplicate avoidance and
doors for the creation and control. Advanced watermarking
conveyance of substance in has turned into a functioning and
vital territory of research, and recognizable proof of proprietor and
improvement and copyright security. The watermark
commercialization of watermarking can be covered up in the
methods is being considered computerized information either
fundamental to help address a obviously or undetectably. For a
portion of the difficulties looked by solid watermark implanting, a great
the fast multiplication of watermarking method is should
computerized content. have been connected. Watermark
can be inserted either in spatial or
recurrence area. Both the spaces are
3. Digital Watermarking extraordinary and have their very
own advantages and disadvantages
The fundamental motivation behind and are utilized in diverse situation.
both cryptography and
steganography is to give mystery
correspondence. In any case, they 4. Applications
are not same. Cryptography
conceals the substance of a mystery Communicated Monitoring
message from noxious individuals,
where as steganography even hide Sponsors need to guarantee that
the presence of the message. Be that they get the majority of the
as it may, another rising innovation broadcast appointment which they
known as computerized buy from supporters. A
watermarking includes the thoughts nontechnical technique in which
and speculations of various subject human perception is utilized to
inclusion, for example, flag watch the communicate and check
handling, cryptography, likelihood the inventiveness by observing or
hypothesis what's more, stochastic hearing is a blunder inclined and
hypothesis, organize innovation, exorbitant. In this way, there ought
calculation plan, and different to be an auto-recognizable proof
procedures. Advanced framework, which may store the
watermarking shrouds the copyright recognizable proof codes to the
data into the computerized communicate. There are a few
information through certain systems like cryptography that store
calculation. The mystery data to be the recognizable proof code in the
implanted can be some content, document header however the
creator's sequential number, information is probably not going to
organization logo, pictures with endure any kind of adjustments
some unique significance. This even arrangement change.
mystery data is inserted to the Watermarking is clearly an
computerized information (pictures, appropriate procedure for data
sound, and video) to guarantee the observing. The Watermark exists
security, information verification, inside the substance and is good
with the introduced base of each duplicate of the work is
communicated gear. Despite the remarkably recognized, like the
fact that, implanting the ID code is unique mark that distinguishes a
extremely entangled contrasted person. The watermark may record
with the cryptography where the the beneficiary for each legitimate
code is set in the document header. dispersion of the work. The
Additionally, it likewise, influences proprietor installs diverse
the visual nature of the work. All watermarks in each duplicate. On
things considered, numerous the off chance that the work is
organizations secure their abused at that point will the
communicates through proprietor have the capacity to
watermarking systems. discover the swindler? Noticeable
watermarking is received for
Possession Assertion exchange following yet
undetectable watermarking is vastly
A legitimate proprietor can recover improved. For instance, in motion
the watermark from computerized picture making, the day by day
content to demonstrate his recordings (additionally called
proprietorship. There are dailies) are conveyed to the people
confinements with literary who are worried about the motion
copyright sees, as they are picture. Some of the time, the
effortlessly removable. Copyright recordings are unveiled to the press,
see imprinted on the physical so the studios utilize unmistakable
archive can't be replicated alongside content on corner of the screen,
the advanced substance. Despite the which recognizes the duplicate of
fact that, it is conceivable that dailies. In this manner, the
content copyright can be set in an watermark is favored as the content
insignificant place of the record to can without much of a stretch be
make them inconspicuous. expelled.
Indistinct and indistinguishable
watermark is the best arrangement Content Authentication
as contrasted with the content stamp
for proprietor recognizable proof. The technique to affirm the honesty
The watermark is not just utilized of watermarked information and to
for recognizable proof of the ensure that the information isn't
copyright proprietorship however being messed with i.e.
for demonstrating the responsibility demonstration of building up or
for archive also. The possession can affirming whether picture is bona
be done by removing the inserted fide or not. The term verification
data from the watermarked report. has a broad scope of implications.
For example, a specialist that
Exchange Tracking chooses whether a segment of
Exchange following is regularly craftsmanship is credible or not, can
considered fingerprinting, where a client see or download it? At long
last, the choice is to whether the not make a difference that the work
substance of a question is remaining is packed or noteworthy changes are
flawless or not after its transmission made. This leads toward semi-
on the web. Numerous social delicate watermarking where the
associations invest energy and framework endure the neighbourly
contributing cash on new advances controls and delicate against
of picture documentation and considerable controls.
computerized libraries development
and so on. In the meantime, these Duplicate Control and
associations can ensure the Fingerprinting
genuineness of the bits of
workmanship they have, since they Duplicate control and fingerprinting
have both the proprietorship and the are utilized to keep individuals from
specialist feelings. At the point making unlawful duplicates of the
when these works of craftsmanship substance. This issue is
are digitized and distributed on the fundamentally the same as the
web, various issues happen. exchange following of the
Typically, a few advanced pictures substance. A proprietor can implant
found on the web have numerous a watermark into advanced
distinctions, and yet putting on a substance that distinguishes the
show to speak to the same bit of purchaser of the duplicate (i.e.
craftsmanship. Utilization of sequential number). In the event
watermarking identified with that unapproved duplicates are
verification contains confided in discovered later, the proprietor can
cameras, video observation and follow the birthplace of the
remote detecting applications, unlawful duplicates.
advanced protection guarantee
proof, journalistic photography, and 5. Transform Domain
computerized rights administration
frameworks. Economically, its Contrasted with spatial-area
applications are required to develop techniques, recurrence space
as does the uses of computerized strategies are all the more generally
content, for instance, GeoVision's connected. The point is to implant
GV-Series advanced video the watermarks in the phantom
recorders for computerized video coefficients of the picture. The most
reconnaissance to forestall altering. regularly utilized changes are the
The computerized work can without Discrete Cosine Transform (DCT),
much of a stretch be altered by Discrete Fourier Transform (DFT),
utilizing PC assets. A answer for the Discrete Wavelet Transform
alter recognition is watermarking, (DWT), the explanation behind
where the validation stamp watermarking in the recurrence
(watermark) can't remain with the space is that the attributes of the
work after scarcest alteration. On human visual framework (HVS) are
the other hand, the framework does
better caught by the phantom strength and perceptivity.
coefficients. Heartiness can be accomplished by
expanding the quality of the inserted
Discrete wavelet changes (DWT) watermark, yet the unmistakable
contortion would be expanded also.
Wavelet Transform is an advanced Nonetheless, DWT is much
method every now and again favoured on the grounds that it gives
utilized in computerized picture both a concurrent spatial restriction
preparing, pressure, watermarking also, a recurrence spread of the
and so on. The changes depend on watermark inside the host picture.
little waves, called wavelet, of The fundamental thought of discrete
differing recurrence and restricted wavelet change in picture process is
term. The wavelet change breaks to multi-separated deteriorate the
down the picture into three spatial picture into sub-picture of various
bearings, i.e. flat, vertical and spatial area and autonomous
corner to corner. Consequently, frequencies.
wavelets mirror the anisotropic
properties of HVS all the more Single Value Decomposition
accurately. Extent of DWT
coefficients is bigger in the most The particular esteem deterioration
reduced groups (LL) at each level of (SVD) is a critical factorization of a
disintegration and is littler for rectangular genuine or complex
different groups (HH, LH, and HL). lattice. A picture could be viewed as
a grid of nonnegative scalar
The Discrete Wavelet Transform sections.
(DWT) is right now utilized in a Expect B is M×N picture; the SVD
wide assortment of flag preparing of B is characterized as:
applications, for example, in sound B= USV' (1)
and video pressure, evacuation of U'.U = I, V'.V= I (2)
commotion in sound, and the re- S = diag(σ , σ2 ,σ3 ,… ) (3)
enactment of remote reception B=σ 1U 1V1 + σ 2U2 V2 + σ 3U3
apparatus appropriation. Wavelets V 3… + σ P U PV P , P=min(M,N)
have their vitality moved in time (4)
and are appropriate for the Where p is the rank of lattice B. σi
investigation of transient, time- are the solitary qualities and
changing signs. Since the greater arranged in plummeting request.
part of the genuine signs The principle favourable position of
experienced are time fluctuating in utilizing SVD in watermarking is
nature, the Wavelet Transform suits unimportant changes of the
numerous applications particular estimations of
exceptionally well. One of the watermarked picture under the
fundamental difficulties of the normal picture preparing assaults.
watermarking issue is to accomplish
a superior trade-off between
6. Advantages of DWT 7. Implementation

• It has many special advantages over DWT-SVD- Matlab


other conventional transforms such
%% DWT - SVD Watermarking
as Discrete Fourier Transform
function [psnr_values,
(DFT) and Discrete Cosine psnr2dB_values] = dwt_svd()
Transform (DCT). The DFT and % clear workspace
clear all;
DCT are full frame transforms and
close all;
hence any change in the transform clc;
coefficient affects the entire image.
folder_name = uigetdir(pwd,
However, there are cases where the
'Select Directory Where the .m
transformation is implemented Files Reside');
using a block based approach if ( folder_name ~= 0 )
if ( strcmp(pwd, folder_name)
== 0 )
• DWT is very useful to identify the cd(folder_name);
areas in the host image where a end
watermark can be embedded else
return;
effectively. This property allows the
end
exploitation of the masking effect of
the human visual system [cover_fname, cover_pthname] =
...
uigetfile('*.jpg; *.png; *.tif;
*.bmp', 'Select the Cover Image');
• After the image is processed by the if (cover_fname ~= 0)
wavelet transform, most of the cover_image =
strcat(cover_pthname,
information contained in the host
cover_fname);
image is concentrated into the LL cover_image = double(
image. LH sub band contains rgb2gray( imread( cover_image ) )
mostly the vertical detail );
cover_image =
information which corresponds to
imresize(cover_image, [512 512],
horizontal edges. HL band 'bilinear');
represents the horizontal detail else
return;
information from the vertical edges
end
[watermark_fname, decoded_correct = zeros(1,
watermark_pthname] = ... numOfKeys);
uigetfile('*.jpg; *.png; *.tif; decoded_wrong = zeros(1,
*.bmp', 'Select the Watermark numOfKeys);
Logo');
if (watermark_fname ~= 0) % [m, n] =
watermark_logo = size(watermark_logo);
strcat(watermark_pthname, % correctWatermarkDiff =
watermark_fname); zeros(1, m*n);
watermark_logo = double( wrongWatermarkDiff = zeros(1,
im2bw( rgb2gray( imread( length(watermark_logo));
watermark_logo ) ) ) );
watermark_logo = for key = 1:numOfKeys
imresize(watermark_logo, [512 % Embedding with the right
512], 'bilinear'); key
else [watermarked_image,
return; original_signature] = ...
end
watermark_embedding(cover_imag
numOfKeys = 20; e, watermark_logo, key,
gaussian_plot = false; print_figures);
print_figures = true;
watermarked_images_dir =
if (gaussian_plot == false) strcat(pwd,
secret_key = 3; % random secret '\watermarked_images\',
key num2str(key), '.png');

watermarked_image = %imwrite(uint8(watermarked_ima
watermark_embedding(cover_imag ge), watermarked_images_dir,
e, watermark_logo, ... 'png');
secret_key, print_figures); imshow(watermarked_image)

% Transform the original


watermark_extraction(watermarked watermrak (i.e. the original
_image, watermark_logo, signature) to
secret_key, ... % the interval [-1, 1]
print_figures, true);
original_signature(find(original_si
else gnature == 0)) = -1;
psnr_values = zeros(1,
numOfKeys); % Measure the degree of
psnr2dB_values = zeros(1, distortion of the original and the
numOfKeys); watermarked
% image using PSNR (dB)
psnr_values(key) = % decoded_correct(key) =
psnr(cover_image, (abs(comb_HH4_LL4) *
watermarked_image); recon_sig_corr')/512^2;
psnr2dB_values(key) = % decoded_correct(key) =
pow2db(psnr_values(key)); sum(comb_HH4_LL4 .*
recon_sig_corr)/512^2;
% Detection with the right
key, message_correct is actually % Detection with the wrong
the key
% watermark_logo because in [~, watermark_wrong,
essence that's what I'm hidding in recon_sig_wrng, LL4wr, HH4wr]
the = ...
% cover image. Whereas the
watermark_correct is actually the watermark_extraction(watermarked
signature _image, watermark_logo, key+11,
% which helps in the detection ...
of false acceptance and false print_figures, false);
% rejection
[~, ~, recon_sig_corr, LL4,
HH4] = ... watermark_wrong(find(watermark
_wrong == 0)) = -1;
watermark_extraction(watermarked
_image, watermark_logo, key, ... LL4wr = LL4wr(:)';
print_figures, true); HH4wr = HH4wr(:)';
LL4wr = LL4wr -
% transform the mean(LL4wr);
watermark_correct(i.e. the HH4wr = HH4wr -
reconstructed_signature) mean(HH4wr);
% and the combwr_HH4_LL4 = [LL4wr
watermark_wrong(i.e. the wrong HH4wr];
reconstructed signature) % decoded_wrong(key) =
% to the interval [-1, 1] (abs(combwr_HH4_LL4) *
watermark_wrong')/512^2;
recon_sig_corr(find(recon_sig_corr % decoded_wrong(key) =
== 0)) = -1; sum(watermark_wrong .*
original_signature)/512;
LL4 = LL4(:)';
HH4 = HH4(:)'; % Keep track of the
LL4 = LL4 - mean(LL4); correlation between the
HH4 = HH4 - mean(HH4); watermark_correct and
comb_HH4_LL4 = [LL4 % the watermark_wrong
HH4]; correlation_correct =
corrcoef(comb_HH4_LL4,
recon_sig_corr);
decoded_correct(key) =
correlation_correct(2, 1); meanOfDecodCorr =
correlation_wrong = mean(decoded_correct);
corrcoef(combwr_HH4_LL4, stdOfDecodCorr =
watermark_wrong); std(decoded_correct);
decoded_wrong(key) = meanOfDecodWrng =
correlation_wrong(2, 1); mean(decoded_wrong);
stdOfDecodWrng =
% Calculate the difference std(decoded_wrong);
between the correct extracted
watermarks and gaussians(meanOfDecodCorr,
% the original watermark and stdOfDecodCorr,
the wrong extracted watermarks meanOfDecodWrng,
and the orignal stdOfDecodWrng);
% [Pfa, Pfr] =
correctKeyWatermarkDiff(key, :) = PfaPfr(meanOfDecodCorr,
watermark_wrong - stdOfDecodCorr,
original_signature; meanOfDecodWrng,
wrongWatermarkDiff(key, :) stdOfDecodWrng, numOfKeys);
= watermark_wrong -
original_signature; % Measure bit error rate, and
plot against threshold T of pfa,
clear('watermark_correct', % where T = pfa/pfr. Or
'comb_HH4_LL4', equivalently plot BER & E versus
'watermark_wrong', ... pfa
'combwr_HH4_LL4', BER =
'original_signature', ... BitErrorRate(wrongWatermarkDiff
'LL4', 'HH4', 'LL4wr', );
'HH4wr');
end
% Clear workspace
clear('watermark_logo_row', end
'watermark_logo_extracted_correct
', ... SIGNATURE GENERATION

'watermark_logo_extracted_wrong' %% Signature generation


, 'watermarked_image', ... algorithm for authenticating
'watermark_correct', matrices U and V
'watermark_wrong', function signature =
'message_correct', ... signature_generation(U, V, key)
'message_wrong',
'watermarked_image'); % Proposed algorithm
% 1. Sum the column of orthogonal
end matrices and create 1-D array
Usum = sum(U); uint8(binary_seq)) ); % signature
Vsum = sum(V); length=512

% 2. Based on the threshold, map clear('Usum', 'Vsum', 'UV_XOR',


the array values into corresponding 'binary_seq');
binary digits end
Usum_threshold = median(Usum);
% threshold based on median value SIGNATURE EMBEDDING
of each Uw & Vw matrix
Vsum_threshold = median(Vsum); %% Signature embedding
algorithm
% transform Usum martix to binary function LL_inv =
using above threshold signature_embedding(LL,
Usum(find(Usum > signature, print_figures)
Usum_threshold)) = 1;
Usum(find(Usum < % 1. Using Haar wavelet, further
Usum_threshold)) = 0; decompose LL band to the 4th
level.
% transform Vsum martix to binary [LL_1, HL_1, LH_1, HH_1] =
using above threshold dwt2(LL, 'haar'); % 1st step
Vsum(find(Vsum > DWT
Vsum_threshold)) = 1; [LL_2, HL_2, LH_2, HH_2] =
Vsum(find(Vsum < dwt2(LL_1, 'haar'); % 2nd step
Vsum_threshold)) = 0; DWT
[LL_3, HL_3, LH_3, HH_3] =
clear('Usum_threshold', dwt2(LL_2, 'haar'); % 3rd step
'Vsum_threshold'); DWT
[LL_4, HL_4, LH_4, HH_4] =
% XOR the 2 matrices to obtain 1- dwt2(LL_3, 'haar'); % 4rth step
D array of dimension 1x512 DWT
UV_XOR = bitxor(uint8(Usum),
uint8(Vsum)); if (print_figures == true)
% Images coding.
% 3. Generate a PSRNG sequence cod_cA = wcodemat(LL_4);
using the key of dim. 1x512 and cod_cH = wcodemat(HL_4);
XOR it with cod_cV = wcodemat(LH_4);
% the UV_XOR 1-D array above cod_cD = wcodemat(HH_4);
rand('seed', key); dec2dim = [cod_cA, cod_cH;
% produce binary sequence to cod_cV, cod_cD];
perform XOR with UVsum
binary_seq = randi([0 1], 1, % Plot 4-th step decomposition
length(UV_XOR)); %figure;
signature = double( %image(dec2dim);
bitxor(uint8(UV_XOR),
%title('4-th step DWT integer_part =
decomposition'); fix(combined_LL4_and_HH4_coef
f_pos);
clear('dec2dim', 'cod_cA', fraction_part =
'cod_cH', 'cod_cV', 'cod_cD'); abs(combined_LL4_and_HH4_coe
end ff_pos - integer_part);

% Convert the integer part into the


% 1. choose all in total 512 binary code of L=16 bits.
coefficients from LL_4 & HH_4 binary_coefficients = {};
% reshape them to row vectors of for p = 1:length(integer_part)
size 1x256 % binary_coefficients{p} =
LL_4 = reshape(LL_4, 1, bitget( uint16( integer_part(p) ),
length(LL_4)^2); 16:-1:1 );
HH_4 = reshape(HH_4, 1, binary_coefficients{p} =
length(HH_4)^2); decimalToBinaryVector(integer_pa
rt(p), 16);
% concatenate the above row end
vectors into a larger row vector of
size 1x512 % 2. Replace the n-th bit (10th bit)
combined_LL4_and_HH4_coef = position of the coefficient with
[LL_4 HH_4]; % signature bit
for m = 1:length(signature)
% keep record of the index position for n = 1:16
of negatives to put back the sign in if (n == 10)
% inverse process binary_coefficients{1,
negative_idxs = m}(n) = signature(m);
combined_LL4_and_HH4_coef(lo end
gical(combined_LL4_and_HH4_co end
ef)) < 0; end
% and then convert the binary code
% keep only the positive integer to its decimal representation
parts bin2decimal = zeros(1,
% length(binary_coefficients));
combined_LL4_and_HH4_coeff_p for x =
osint = round( abs( 1:length(binary_coefficients)
combined_LL4_and_HH4_coef ) ); bin2decimal(x) =
binaryVectorToDecimal(double(bi
% separate the integer from the nary_coefficients{1, x}));
decimal fraction end
combined_LL4_and_HH4_coeff_p
os = % reconstruct orignal array from
abs(combined_LL4_and_HH4_coe integer and decimal fraction parts
f);
% cmb_coef = integer_part + LL_2_inv = idwt2(LL_3_inv,
fraction_part; HL_3, LH_3, HH_3, 'haar');
bin2decimal = bin2decimal + LL_1_inv = idwt2(LL_2_inv,
fraction_part; HL_2, LH_2, HH_2, 'haar');
LL_inv = idwt2(LL_1_inv, HL_1,
% put back the negative signs LH_1, HH_1, 'haar');
bin2decimal(find(negative_idxs ==
1)) = - % Clear workspace
bin2decimal(find(negative_idxs == clear('LL_1_inv', 'LL_2_inv',
1)); 'LL_3_inv', 'LL_4_modified', ...
'HL_1', 'HL_2', 'HL_3', 'HL_4',
% Clear workspace ...
clear('LL_1', 'LL_2', 'LL_3', 'LH_1', 'LH_2', 'LH_3', 'LH_4',
'LL_4', 'HH_4', ...
'combined_LL4_and_HH4_coef',... 'HH_1', 'HH_2', 'HH_3',
'negative_idxs', 'HH_4_modified');
'combined_LL4_and_HH4_coeff_p
os', 'integer_part',... end
'fraction_part',
'binary_coefficients', 'signature'); WATERMARK EMBEDDING

% reshape the modified LL_4 & %% Watermark Embedding


HH_4 sub-bands to their original algorithm
size 16x16 function [watermarked_image,
% each signature] =
LL_4_modified = watermark_embedding(cover_imag
bin2decimal(1:256); e, watermark_logo, key,
HH_4_modified = print_figures)
bin2decimal(257:end);
LL_4_modified = % 1. Apply Haar wavelet and
reshape(LL_4_modified, 16, 16); decompose cover image into four
HH_4_modified = sub-bands:
reshape(HH_4_modified, 16, 16); % LL, HL, LH, and HH
[LL, HL, LH, HH] =
% Clear workspace dwt2(cover_image, 'haar');
clear('bin2decimal');
% 2. Using Haar wavelet, further
% 3. Apply the inverse DWT with decompose LL band to the 4th
modified LL4 and HH4 band level.
coefficients. % [LL_1, HL_1, LH_1, HH_1] =
LL_3_inv = idwt2(LL_4_modified, dwt2(LL, 'haar'); % 1st step
HL_4, LH_4, HH_4_modified, DWT
'haar');
% [LL_2, HL_2, LH_2, HH_2] = % Sh_diag(ii) = Sw_diag(ii);
dwt2(LL_1, 'haar'); % 2nd step % end
DWT if (length(watermark_logo) >=
% [LL_3, HL_3, LH_3, HH_3] = 256)
dwt2(LL_2, 'haar'); % 3rd step Sh_diag(1:length(Sh), :) =
DWT Sw_diag(1:length(Sh), :);
% [LL_4, HL_4, LH_4, HH_4] = elseif(length(watermark_logo) <
dwt2(LL_3, 'haar'); % 4rth step 256)
DWT
Sh_diag(1:length(watermark_logo)
if (print_figures == true) , :) =
% Images coding. Sw_diag(1:length(watermark_logo
cod_cA1 = wcodemat(LL); ), :);
cod_cH1 = wcodemat(HL); end
cod_cV1 = wcodemat(LH); Sh(logical(eye(size(Sh)))) =
cod_cD1 = wcodemat(HH); Sh_diag;
dec2d = [cod_cA1, cod_cH1;
cod_cV1, cod_cD1]; %----- Signature generation
algorithm
% Plot one step decomposition % 6. Generate signature
%figure; signature =
%image(dec2d); signature_generation(Uw, Vw,
%title('One step DWT key);
decomposition');
%---- Signature embedding
clear('dec2d', 'cod_cA1', algorithm
'cod_cH1', 'cod_cV1', 'cod_cD1'); % 7. Embedd signature to cover
end image
% LL_inv =
% 3. Apply SVD to HH (high signature_embedding(LL_4,
frequency) band HH_4, signature);
[Uh Sh Vh] = svd(HH, 'econ'); LL_inv =
signature_embedding(LL,
% 4. Watermark logo W is signature, print_figures);
decomposed using SVD
[Uw Sw Vw] = % 8. Apply SVD to obtain the
svd(watermark_logo, 'econ'); modified HH band wich now holds
the SV's of
% 5. Replace singular values of the % watermark logo
HH (high frequency) band with the HH_modified = Uh * Sh * Vh';
% singular values of the watermark
Sh_diag = diag(Sh); % 9. Apply inverse DWT with
Sw_diag = diag(Sw); modified LL(LL_inv) &
% for ii = 1:size(Sw, 1) HH(HH_modified) band to
% obtain the watermarked image % reshape them to row vectors of
% Here the HH band should be the size 1x256
one modified with SV's LLw_4 = reshape(LLw_4, 1,
watermarked_image = length(LLw_4)^2);
idwt2(LL_inv, HL, LH, HHw_4 = reshape(HHw_4, 1,
HH_modified, 'haar'); length(HHw_4)^2);

if (print_figures == true) % concatenate the above row


figure; vectors into a larger row vector of
subplot(2, 2, 1); size 1x512
imshow(cover_image, []); combined_LLw_4_and_HHw_4_c
title('Cover image'); oeff = [LLw_4 HHw_4];
subplot(2, 2, 2);
imshow(watermarked_image, % keep record of the index position
[]); of negatives to put back the sign in
title('Watermarked image'); % inverse process
subplot(2, 2, 3); negative_watermarked_idxs =
imshow(watermark_logo, []); combined_LLw_4_and_HHw_4_c
title('Watermark logo'); oeff(logical(combined_LLw_4_and
end _HHw_4_coeff)) < 0;

clear('LL', 'HL', 'LH', 'HH',... % keep only the positive integer


'LL_1', 'HL_1', 'LH_1', 'HH_1', parts
... %
'LL_2', 'HL_2', 'LH_2', 'HH_2',... combined_LLw_4_and_HHw_4_c
'LL_3', 'HL_3', 'LH_3', 'HH_3',... oeff_posint = round( abs(
'LL_4', 'HL_4', 'LH_4', 'HH_4'); combined_LLw_4_and_HHw_4_c
oeff ) );
clear('Uh', 'Sh', 'Vh', 'Uw', 'Sw',
'Vw', 'Sh_diag', 'Sw_diag'); % separate the integer from the
decimal fraction
end combined_LLw_4_and_HHw_4_c
oeff_pos =
abs(combined_LLw_4_and_HHw_
SIGNATURE EXTRACTION 4_coeff);
integer_part_of_watermarked_ima
%% Signature extraction algorithm ge =
function reconstructed_signature = fix(combined_LLw_4_and_HHw_
signature_extraction(LLw_4, 4_coeff_pos);
HHw_4, lengthOfWatermark) fraction_part_of_watermarked_ima
ge =
% 2. Select all coefficient from abs(combined_LLw_4_and_HHw_
LL4 and HH4 band 4_coeff_pos -
integer_part_of_watermarked_ima if (v == 10)
ge); reconstructed_signature(u)
=
% Clear workspace binary_watermarked_coefficients{
clear('LLw_4', 'HHw_4', 1, u}(v);
'combined_LLw_4_and_HHw_4_c end
oeff', ... end
'negative_watermarked_idxs', end
'fraction_part_of_watermarked_im
age'); % Clear workspace
clear('binary_watermarked_coeffici
% Convert the integer part of ents');
selected coefficient into the binary
code of L bits end
binary_watermarked_coefficients =
{}; WATERMARK EXTRACTION
for y =
1:length(combined_LLw_4_and_H %% Watermark extraction
Hw_4_coeff_pos) algorithm
% function
binary_watermarked_coefficients{ [watermark_logo_extracted,
y} = bitget( uint16( generated_signature,
integer_part_of_watermarked_ima reconstructed_signature, LLw_4,
ge(y) ), 16:-1:1 ); HHw_4] =
watermark_extraction(watermarked
binary_watermarked_coefficients{ _image, watermark_logo, key,
y} = print_figures,
decimalToBinaryVector(integer_pa signature_authentication)
rt_of_watermarked_image(y), 16);
end % 1. Using Haar wavelet,
decompose the noisy watermarked
% Clear workspace image into four
clear('combined_LLw_4_and_HH % sub-bands: LL, HL, LH, and HH
w_4_coeff_pos', [LLw HLw LHw HHw] =
'integer_part_of_watermarked_ima dwt2(watermarked_image, 'haar');
ge');
% 2. Further decompose LL band
% 3. Extract the n-th (10-th) bit to the 4th level.
from the coefficient to extract the [LLw_1, HLw_1, LHw_1,
signature. HHw_1] = dwt2(LLw, 'haar'); %
reconstructed_signature = zeros(1, 1st step DWT
lengthOfWatermark); [LLw_2, HLw_2, LHw_2,
for u = 1:lengthOfWatermark HHw_2] = dwt2(LLw_1, 'haar');
for v = 1:16 % 2nd step DWT
[LLw_3, HLw_3, LHw_3, % proceed to watermark
HHw_3] = dwt2(LLw_2, 'haar'); extraction if authentication is
% 3rd step DWT successful
[LLw_4, HLw_4, LHw_4, % helpdlg('Authentication
HHw_4] = dwt2(LLw_3, 'haar'); was successful!');
% 4rth step DWT
% 8. Apply SVD to HH band
% Clear workspace [Ucw Scw Vcw] = svd(HHw,
clear('LLw_1', 'LLw_2', 'LLw_3', 'econ');
...
'HLw_1', 'HLw_2', 'HLw_3', % 9. Extract the singular
'HLw_4', ... values from HH band
'LHw_1', 'LHw_2', 'LHw_3', HH_singularValues =
'LHw_4', ... zeros(length(watermark_logo));
'HHw_1', 'HHw_2', 'HHw_3', ... Shh_diag =
'LLw', 'HLw', 'LHw'); diag(HH_singularValues);
Scw_diag = diag(Scw);
% 3. Apply SVD to watermark %for jj = 1:size(Sw_x, 1)
logo % Shh_diag(jj) =
[Uw_x Sw_x Vw_x] = Scw_diag(jj);
svd(watermark_logo, 'econ'); %end
if (length(watermark_logo) >=
% 4. Generate signature using Uw 256)
& Vw matrices Shh_diag(1:length(Scw), :)
generated_signature = = Scw_diag;
signature_generation(Uw_x, elseif
Vw_x, key); (length(watermark_logo) < 256)

% 5. Extract signature from LLw_4 Shh_diag(1:length(watermark_logo


& HHw_4 bands using all of the ), :) =
512 Scw_diag(1:length(watermark_log
% coefficients o), :);
reconstructed_signature = end
signature_extraction(LLw_4,
HHw_4, length(watermark_logo)); HH_singularValues(logical(eye(siz
e(HH_singularValues)))) =
if (signature_authentication == Shh_diag;
true)
% 10. Construct the
% 6. Compare the 2 signatures watermark using singular values
if ( reconstructed_signature == and orthogonal matrices
generated_signature | % Uw and Vw obtained using
corr2(reconstructed_signature, SVD of original watermark
generated_signature) > 0.7 )
watermark_logo_extracted = % index = randi([1 256], 1,
Uw_x * HH_singularValues * length(watermark_logo));
Vw_x';
% 8. Apply SVD to HH band
% Clear workspace [Ucw Scw Vcw] = svd(HHw,
clear( 'Uw_x', 'Sw_x', 'Vw_x', 'econ');
...
'Ucw', ',Scw', 'Vcw', % 9. Extract the singular values
'HH_singularValues', 'Shh_diag', ... from HH band
'Scw_diag'); HH_singularValues =
zeros(length(watermark_logo));
if (print_figures == true) Shh_diag =
figure; diag(HH_singularValues);
Scw_diag = diag(Scw);
imshow(watermark_logo_extracted % Choose random values from
, []); Scw base on key index
title('Extracted watermark'); % Scw_random_diag =
end Scw(index);

% This constitutes a blind %for jj = 1:size(Sw_x, 1)


decoding as watermark extraction % Shh_diag(jj) = Scw_diag(jj);
process does % Shh_diag(jj) =
% not require original cover Scw_random_diag(jj);
image for extracting the watermark %end
at the receiver % Shh_diag =
else Scw_random_diag;
errordlg('Authetication if (length(watermark_logo) >=
Failure. The signatures do not 256)
match. No watermark extracted!'); Shh_diag(1:length(Scw), 1) =
watermark_logo_extracted = Scw_diag;
zeros(length(watermark_logo), elseif (length(watermark_logo) <
length(watermark_logo)); 256)
return;
end Shh_diag(1:length(watermark_logo
else ), :) =
% Proceed directly to watermark Scw_diag(1:length(watermark_log
extraction based on random o), :);
selected end
% values from HH band using
the key as an indicator HH_singularValues(logical(eye(siz
% rand('seed', key); e(HH_singularValues)))) =
% produce random sequence to Shh_diag;
choose HH values
% Clear workspace
clear('Ucw', 'Scw', 'Vcw',
'Shh_diag', 'Scw_diag',
'Scw_random_diag'); 9. Conclusion
% 10. Construct the watermark
using singular values and
orthogonal matrices Hence, the watermark was applied to
% Uw and Vw obtained using the image and it was undetectable to
SVD of original watermark the human eye. It was noticed that
watermark_logo_extracted = the watermark image’s matrix
Uw_x * HH_singularValues * should be equal to or smaller than
Vw_x';
the matrix of the cover image for
% Clear workspace proper application of watermark on
clear('HH_singularValues'); the image.

if (print_figures == true)
figure;

imshow(watermark_logo_extracted
, []);
title('Extracted watermark');
end

end

end

8. Result Screenshots
10. References

DWT Based Digital Watermarking DESIGN AND IMPLEMENTATION


Technique and its Robustness on Image OF IMAGE STEGANOGRAPHY
Rotation, Scaling, JPEG compression,
Cropping and Multiple Watermarking Journal of Signal and Image Processing
S.M. Mohidul Islam ; Rameswar ISSN: 0976-8882 & E-ISSN: 0976-8890,
Debnath ; S.K. Alamgir Hossain Volume 3, Issue 3, 2012, pp.-111-113.
CHINCHOLKAR A.A.* AND URKUDE
D.A. Department of Computer Science,
Digital watermarking techniques for Jawaharlal Darda Institute of Engineering
security applications & Technology, Yavatmal, MS, India.
Sonam Tyagi ; Harsh Vikram
Singh ; Raghav Agarwal ; Sandeep Kumar
Gangwar

Real Time Implementation of Digital


Watermarking Algorithm for Image
Digital watermarking using DWT and and Video Application
DES
Nirupma Tiwari ; Manoj Kumar Amit Joshi 1, Vivekanand Mishra 1 and
Ramaiya ; Monika Sharma R. M. Patrikar 2 1 Sardar Vallabhbhai
National Institute of Technology Surat 2
Visvesvaraya National Institute of
A Survey of Digital Watermarking
Technology Nagpur India
Techniques and its Applications

Lalit Kumar Saini1 , Vishal Shrivastava2


M.Tech1 Research Scholar, Professor2 A Study on Digital Watermarking
Department of Computer Science and Techniques
Engineering, Arya College of Engineering. L. Robert, Department of Computer
& Information Technology, Jaipur, India Science, Government Arts College,
Coimbatore, Tamilnadu, India
T.Shanmugapriya, Research Scholar,
Bharathiar University, Coimbatore, Tamil
Nadu, India

S-ar putea să vă placă și