DCT digital watermarking
3 views (last 30 days)
Show older comments
Hi Everyone,
I am working on a digital watemarking project. this is my first matlab project. So I really need help. I can embed and extract watermark from bmp or jpg. however because of that I do not change domain, watermarks are not robust in jpgs against compression.
I tried to get DCT block, then I quantized it, after that I tried to embed my watermark, at the end I tried to dequantize and inverseDCT. I could not successfully do it.
Can you please give a piece of code to show how can I do it
3 Comments
SHIREESHA THADKAPALLY
on 27 Mar 2018
are you using image watermark or text as watermark i mean u r embed text in image or image in image?
Answers (1)
Sean de Wolski
on 9 Jun 2011
Hi Halil,
The reason you're seeing the corrupted image is because you're working on all three channels (R,G,B) at once. These are three independent channels and thus need to be dealt with independently.
Here's your code modified to work with each channel independently. It doesn't actually do anything, but shows that the image will not be corrupted:
vec = @(x)reshape(x,numel(x),1);
image1 = imread('peppers.png'); % IPT sample image (don't call it image, MATLAB stock function)
[m,n,k] = size(image1); % get size of your image
image2 = zeros(m,n,k,class(image1)); %preallocate second image
for ii = 1:3;
image2(:,:,ii) = reshape(idct(dct(vec(image1(:,:,ii)))),m,n);
%vector of channel -> dct -> idct -> reshaped to original size
end
figure(1)
imshow(image1, [])
title('Original Image')
figure(2)
imshow(image2, [])
title('Image2')
Good Luck!
6 Comments
Bhavneet Sharma
on 6 Apr 2019
Attempt to execute SCRIPT dct as a function:
C:\Users\Downloads\IMAGE WATERMARKING\DCT\dct.m
Error in dct (line 6)
image2(:,:,ii) = reshape(idct(dct(vec(image1(:,:,ii)))),m,n);
this is the complete error messgae.
Walter Roberson
on 6 Apr 2019
You created a script named dct.m that attempts to call upon the MATLAB provided dct() function, but gets confused because its own name is also dct .
Rename your script to something else, such as try_dct.m
You will probably also need the change I give above to define vec .
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!