DSPRelated.com
Forums

Watermarking- losing color component..plz help

Started by p_r_a_d53 March 15, 2009
I m working on the project "wavelet based watermarking". am using the dwt2 function to get the approximation parameter. while doing so.. Iam losing the color of the watermarked image.
plzz help me out in obtaining the color component
Here is my code..
a=imread('H:\pics\earth_from_space.jpg');

%i=imread('earth_from_space.jpg');

%i=uigetfile( '*.*' , 'select the image');

%[filename1,pathname]=uigetfile( '*.*' , 'select the second image');

i=imread('H:\pics\Tulips.jpg');

[row,col]=size(r);

Tr0;%%%% initializing the threshold

k=0.0025; %%% a constant value

[ca,ch,cv,cd] = dwt2(a,'db1');%%%% applying wavelets of debeluecheis

c1 = [ch cv cd];%%% getting the high frequency vertical,diagnal,horizontal details

[h, w] = size(ca');

[m, n] = size(c1');

%W=dmg(r,ri);

[caa chh cvv cdd]=dwt2(i,'db1'); %%%%% applying wavelets for the secong image and estimating the horizontal vertical and
%diagnal details
W;

%size(ri);

cw= [chh cvv cdd]; chd=[chh cdd];

% Adding watermark image.

q=0.001

ca=imresize(ca,[size(W)]);

watwav=k*ca+q*W;

figure(3);

imshow(watwav);

title('image(watermarked) obtained using wavelet transforms');

[wa]=idwt2(watwav,chh,cvv,cdd,'db4',size(ca));%%%applying inverse wavelet transforms

wa=imresize(ca,[size(wa)])

wa=watwav-k*ca;

figure(4),imshow(wa);

title('image2 obtained after reverse watermarking using wavelet transforms');

caa=imresize(caa,size(watwav));

ca=watwav-wa;

figure(5),imshow(ca);

title('image1 obtained after reverse watermarking using wavelet transforms');
%origt(ca);
%snr *log(orig);
%wattt(watwav);
%snwatt *log((watt));
%msewav=sum(sum((watt-orig).*(watt-orig)))/65536;

%PSNRwav *log10(sqrt(msewav)/255);

%k=watdet3(watermark,image1);

% watbpp2bin(watwav);

% [row col]=size(ca);

% bppwav=((numel(watwav))/row)/100;

% %%%%%% psnr for watermarked image using wavelets

% origt(double(r));

% snr *log(abs(orig));

% wattt(double(watwav));

% snwatt *log((watt));

% watt=imresize(watt,size(orig));

% mseti=sum(sum((watt-orig).*(watt-orig)))/65536;

% PSNRti *log10(sqrt(mseti)/255);

% %k=watdet3(watermark,image1);

% watbpp2bin(watwav);

% [row col]=size(r);

% bppti=((numel(watwav))/row)/100

a=rgb2gray(a);

a=imresize(a,size(watwav));

origt(abs(double(a)));

snr *log((orig));

wattt(abs(double(watwav)));

snwatt *log(abs(watt));

mse=sum((sum( (abs(watt-orig)).*abs(watt-orig)) ))/65535;

PSNRs(20*log10(255/sqrt(mse)))