Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute MATLAB/Octave Online

Clear all;
x=double(imread(‘lena.jpg’));
figure,imshow(x/255);
y=x;
a=zeros(300,500);
a(100:250 ,100:350) =1;
figure, imshow(a);
% watermarking
x1=x( :, :, 1);
x2=x( :, :, 2);
x3=x( :, :, 3);
dx1=dct2(x1);  dx11=dx1;
dx2=dct2(x2);  dx22=dx2;
dx3=dct2(x3);  dx33=dx3;
load m.dat  %binary mask for watermarking
g=10     %coefficient of watermarking  strength
(rm,cm)= size (m);
dx1(1:rm,1:cm)= dx1(1:rm,1:cm)+g*m;
dx2(1:rm,1:cm)= dx2(1:rm,1:cm)+g*m;
dx3(1:rm,1:cm)= dx3(1:rm,1:cm)+g*m;
figure , imshow(dx1);
figure , imshow(dx2);
figure , imshow(dx3);
y1=idct2(dx1);
y2=idct2(dx2);
y3=idct2(dx3);
y( : , : , 1)=y1;
y( : , : , 2)=y2;
y( : , : , 3)=y3;
figure, imshow(y1);
figure, imshow(y2);
figure, imshow(y3);
figure, imshow(y);
figure, imshow(y/255);
z=y;
(r,c,s) = size(z)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.