Watermarking in the Frequency Domain

2 vues (au cours des 30 derniers jours)
Hadi Ghahremannezhad
Hadi Ghahremannezhad le 11 Nov 2020
I am new in Matlab and I have an assignment that is asking for watermarking an image using DCT transform:
  • Read Lin.jpg color image and apply DCT.
  • Threshold the logo.jpg (watermark) into binary and ten times of its strength, and then add it to the coefficient of transformed Lin image.
Here are the two images:
I have three questions:
  1. Am I supposed to divide Lin.jpg into 8x8 blocks and logo.jpg into 2x2 blocks or that is not necessary?
  2. what does it mean by : "ten times of its strength"? Is that just multiplying by 10?
  3. How can I get the coefficient of transformed Lin.jpg image?
Here is what I tried:
img = imread('Lin.jpg');
wImg = imread('njit_logo.jpg');
wImgBinary = imbinarize(wImg) * 10;
[rows, cols] = size(img(:,:,1));
[Wrows, Wcols] = size(wImgBinary);
% make the watermark image as large as the original
watermark = zeros(size(img), 'uint8');
for column = 1:cols
for row = 1:rows
watermark(row, column) = wImgBinary(mod(row,Wrows)+1, mod(column,Wcols)+1);
end
end
watermark = watermark(1:rows, 1:cols);
% apply dct and add with watermark at each channel
for i = 1:3
imgDct = dct2(img(:,:,i));
C = imgDct + double(watermark);
Iw(:,:,i) = round(real(idct2(C)));
end
IIw = uint8(Iw);
figure, imshow(IIw), title('watermarked image');
  9 commentaires
Jevan Watson
Jevan Watson le 12 Nov 2020
So wait because he confuses me too... isn't idct supposed to be one of the five images in part A too? or does part B provide the last 2 images he asked for in A. Because in the above I didn't notice where you did the inverse dct on Lin
Hadi Ghahremannezhad
Hadi Ghahremannezhad le 12 Nov 2020
part B it says first DCT the noisy image. Then subtract the (logo*10) and at the end IDCT the result. For me, it is in the last line above (uint8(real(idct2(sub)))). But I got black images from this so I applied DCT on the (logo) as well.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by