Base Image After Watermarking
In this program the base image is a gray scale image and the water mark image is a black&white image. The water mark image will insert on any bit plain position that will be chosen by the chaotic random sequence. Before inserting the image the image will scrambled and inserted to the base image.
clear all; close all; clc;
tic;
f1 = imread('le.tif');
%f1 = imresize(f1,[64,64]);
%f1 = rgb2gray(f1);
[m n] = size(f1);
f=zeros(m,n);
for i=1:m
for j=1:n
if f1(i,j)>=128
f(i,j)=1;
end
end
end
f2=f;
figure,imshow(f1),title('Water Mark Image');
si1=m*n;
con =10;
rimg = f;
if m == n
while (con > 0)
for i =1:m
for j = 1:n
xva = mod((i+j),m);
if xva == 0
xva=m;
end
%XA(i,j) = xva;
yva = mod((i+(2*j)),m);
if yva == 0
yva=m;
end
%YA(i,j) = yva;
rimg(xva,yva) = f(i,j);
end
end
con = con-1;
f = rimg;
end
end
figure,imshow(f);
imwrite(f,'wat1.tif');
img = imread('cameraman.tif');
img = imresize(img,[256,256]);
[m1,n1]=size(img);
si=m1*n1;
Z=zeros(1,si1);
Z1=zeros(1,si1);
Zn=0.3; mu=3.5699456;
for i=1:(si1)
Z(i)=mu*Zn*(1-Zn);
Zn=Z(i);
if Zn >= 0.75
Z1(i)=7;
elseif Zn >= 0.5
Z1(i)=6;
elseif Zn >= 0.25
Z1(i)=5;
else
Z1(i)=4;
end
end
img1=img;
img2=img(:)';
f1=f(:)';
co=0;
%co1=1;co2=0;
for i=1:si1
S1=dec2bin(img2(i),8);
S3 = Z1(i);
S1(S3)=num2str(f(i));
img2(i)=bin2dec(S1);
end
res=reshape(img2,m1,n1);
figure,imshow(res);
imwrite(res,'water.tif');