DCT digital watermarking
이전 댓글 표시
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
Sean de Wolski
2011년 6월 8일
Could you please give us a piece of code so we can see what you've done? Perhaps sample images to show the issues you're seeing as well.
Halil
2011년 6월 9일
편집: Walter Roberson
2019년 4월 6일
SHIREESHA THADKAPALLY
2018년 3월 27일
are you using image watermark or text as watermark i mean u r embed text in image or image in image?
답변 (1개)
Sean de Wolski
2011년 6월 9일
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
Halil
2011년 6월 13일
Bhavneet Sharma
2019년 4월 6일
while executing you code i got an error given below:
Error in dct (line 6)
image2(:,:,ii) = reshape(idct(dct(vec(image1(:,:,ii)))),m,n);
can you suggest me how to sove this error?
Walter Roberson
2019년 4월 6일
Please show the complete error message.
Walter Roberson
2019년 4월 6일
vec = @(x) double(x(:));
Bhavneet Sharma
2019년 4월 6일
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
2019년 4월 6일
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 .
카테고리
도움말 센터 및 File Exchange에서 Watermarking에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!