how I can insert a simple message on a picture ??
Show older comments
%this is the code to create a watermark image with key :
clc;clear all;close all;
img = imread('C:\Users\yassine\Desktop\wmark\home.jpg');
img = rgb2gray(img);
img = double(img);
c = 0.01; %Initialise the weight of Watermarking
figure,imshow(uint8(img)),title('Original Image');
[p q] = size(img);
%Generate the key
n = awgn(img,4,3,'linear');
N = imabsdiff(n,img);
figure,imshow(double(N)),title('Key');
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');
[ca,ch,cv,cd] = dwt2(img,Lo_D,Hi_D);
%Perform the watermarking
y = [ca ch;cv cd]; Y = y + c*abs(y).* N;
p=p/2;q=q/2; for i=1:p for j=1:q nca(i,j) = Y(i,j); ncv(i,j) = Y(i+p,j); nch(i,j) = Y(i,j+q); ncd(i,j) = Y (i+p,j+q); end end
wimg = idwt2(nca,nch,ncv,ncd,Lo_R,Hi_R);
figure,imshow(uint8(wimg)),title('Watermarked Image');
diff = imabsdiff(wimg,img);
figure,imshow(double(diff));title('Differences');
%but the key is used to protect the message so how I can insert my own msg(HELLO) in the image (regardless spatial domain or frequentiel)
Accepted Answer
More Answers (1)
Sean de Wolski
on 27 Apr 2015
1 vote
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!