code for different attacks on watermarking

Answers (1)

See section 24.3 here:
You'll find lots of papers on it.
(Anticipating your next question.....)
Sorry, I don't have any of them coded up for you.

19 Comments

i want the code for different geometric attacks on watermarking.please help me.am unable to change the code.please check the file and modify it for cropping and scaling attacks and for filtering attacks..please help me if possible.i need it badly
Yep, I anticipated your next question perfectly.
Again, sorry I don't have any code to do that. I'd have to spend days developing it just like you will, or months like the people who wrote those papers did. If I had such code or could write it in 5 minutes or less, I'd give it to you. But I'm sure it's not trivial. That said, once you write your code if you have questions about an error message, we can answer that. But we can't write a whole turnkey application suite for you. We just don't have that much time to donate to you. I'm sure there are graduate students making image forensics their entire masters or Ph.D., so it's not trivial.
If you really need it done and can't do it yourself, the Mathworks would be delighted to write the code for you. Contact their consulting department here:
Of course they don't do it for free so you have to decide how much it's worth to you do get it done.
The code you attached appears to be from https://github.com/ShurenQi/FGPCET . You would need the rest of that third-party code in order to run that file.
i have that file but i cant run different attacks on it.please help me..i need it..badly..please
can you please check the file error...and help me to solve the issue.
clc
close all
%Original Image
host=imread('128.jpg');
subplot(1,3,1)
figure(1);
imshow(host);
title('Original color image');
[h_LL,h_LH,h_HL,h_HH]=dwt2(host,'haar');
img=h_LL;
%watermark Image
watermark=imread('32.jpg');
watermark=imresize(watermark,[m n])
subplot(1,3,2)
figure(2);
imshow(watermark);
title('Watermark image');
[w_LL,w_LH,w_HL,w_HH]=dwt2(watermark,'haar');
img_wat=w_LL;
% watermark embedding
wd_LL=h_LL+(0.03*w_LL);
%output
watermarked=idwt2(wd_LL,h_LH,h_HL,h_HH,'haar');
imwrite(uint8(watermarked),'Watermarked.jpg');
subplot(1,3,1)
imwrite(res,'DwtwatermarkedImage.jpg','jpg');
figure(3);
res=((uint8(watermarked)));
imshow(res);
title('Watermarked Image');
inputImage=res;
wm=imread(res);
[wm_LL,wm_LH,wm_HL,wm_HH]=dwt2(wm,'haar');
%watermark extraction
ewat=(wm_LL-h_LL)/0.03;
%output
watermarked=idwt2(ewat,w_LH,w_HL,w_HH,'haar');
figure(4);imshow(uint8(watermarked));
op=((uint8(watermarked)));
imwrite(uint8(watermarked),'EWatermark.jpg');title('Extracted Watermark');
mse_extraction=MSE(res,op)
psnr=PSNR(res,op)
You forgot to attach the error. Please include ALL the red text. And we can't run your code anyway because you forgot to attach 128.jpg and 32.jpg.
( Unrecognized function or variable 'm'.
Error in IN2 (line 18)
watermark=imresize(watermark,[m n])
)
it is the error
You need to assign m as the number of rows you want the resized image to be after resizing. Right now it's unknown/unassigned.
please modify my code and send the file.i am unable to do that one
Perhaps you mean
[hostRows, hostColumns, hostNumColorChannels] = size(host);
watermark=imresize(watermark, [hostRows, hostColumns]);
which will resize the watermark image to be the same size as the host image.
error is
Matrix dimensions must agree.
Error in IN2 (line 30)
wd_LL=h_LL+(0.03*w_LL);
please help me to modify my code.please attach the changed file
One of the arrays is based on the size of the original image. The other is based on the size of the 32 x 32 watermark. There is not going to be any way to add them together.
Matrix dimensions must agree.
Error in dwt (line 29)
watermarked_LL = host_LL + (0.03*watermark_LL);
is the error...cant understand what is the problem
what is the host file [m n p]?
I computed that here:
[hostRows, hostColumns, hostNumColorChannels] = size(host);
Notice that I did not use cryptics one-letter variable names that make your code look like an undecyperable alphabet soup mess of a code. I used descriptive variable names where it's glaring obvious what the variables recomment - a practice I hope you'll follow. If you still don't know, then
m = hostRows
n = hostColumns
p = hostNumColorChannels
For your error, it's saying that the two matrices are different sizes so you can't add them together. Put these lines in your code before the error line:
[LLRows, LLColumns, LLNumColorChannels] = size(watermarked_LL)
[hostLLRows, hostLLColumns, hostLLNumColorChannels] = size(host_LL)
What does that report to the command window? Evidently something does not match up.
read the documentation for dwt2 https://www.mathworks.com/help/wavelet/ref/dwt2.html#d123e27693 and see that the first output is half the size of the input. You resized your watermark to 32 by 32 so your first output from dwt2 of that would be about 16 x 16.
In order to be able to add that 16 x 16 array to the output of the dwt2 from the original image, that other dwt2 would also have to be 16 x 16. Which would require that the original image is 32 x 32. But that is clearly not the case.
You have a small number of options at this point:
1. You can resize the original image to 32 x 32 as well 2. You can resize the watermark to the same size as the image 3. you can give up on trying to add those matrices together 4. you can choose a subset of the larger dwt2 result to add the watermark to, leaving the rest unchanged.
Hi Image Analyst,
we need a help from you
can you send a response to my mail if possible.
we will contact you reg: image processing help
my mail id: srinivas.nato@gmail.com
Hi Image Analyst,
we need a help from you
can you send a response to my mail if possible.
we will contact you reg: image processing help
my mail id: srinivas.nato@gmail.com
Image Analyst does not volunteer email support. He will not help you through email.

Sign in to comment.

Asked:

on 23 Apr 2022

Commented:

on 26 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!