I am trying wavelet watershed method but am struck... help!!!
Show older comments
clc; close all;
a=imread('1.jpg');
b= rgb2gray(a);
c=imresize(b,[300 300]);
d=double(c);
d=uint8(d);
e=.001;
subplot(4,4,1);imshow(a), title(' orginal image');
subplot(4,4,2);imshow(b), title(' gray image');
subplot(4,4,3);imshow(c), title('resized image');
subplot(4,4,4);imshow(d), title('doubled image');
% intialise weight of watermark
[p q]=size(d);
%generate the key (x)
x=imread('2.jpg');
y= rgb2gray(x);
z=imresize(double(y), [p q]);
z=uint8(z);
subplot(4,4,5);imshow(x), title(' key image');
subplot(4,4,6);imshow(y), title(' gray key image');
subplot(4,4,7);imshow(z), title('resized key image');
%compute 2D wavelet transform
[ca,ch,cv,cd]=dwt2(d,'db1');
%perform watermarking
l=[ca ch;cv cd];
imresize(double(l));
l=uint8(l);
subplot(4,4,10);imshow(l), title('process of watermarking image');
p=p/2;
q=q/2;
for i=1:p
for j=1:q
kca(i,j)=n(i,j); %#ok<*SAGROW>
kcv(i,j)=n(i+p,j);
kch(i,j)=n(i,j+q);
kcd(i,j)=n(i+p,j+q);
end;
end
%display watermark
wa=idwt2(kca,kcv,kch,kcd,db1);
subplot(4,4,8);imshow(wa), title('watermarked image');
%extraction of key frm image
%compute 2d wavelet transform
[rca,rcv,rch,rcd]=dwt2(wa,db1);
n=[rca,rcv,rch,rcd];
o=n-y;
subplot(4,4,9);imshow(double(o*4)), title('extracted key from watermarked image');
1 Comment
Walter Roberson
on 16 Jun 2015
I do not see anything in that code that has to do with watershed. I do see parts of the code that have to do with watermarks. Should your reference to watershed be reference to watermark ?
Answers (0)
Categories
Find more on Watermarking in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!