Watermarking in the Frequency Domain
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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:
- Am I supposed to divide Lin.jpg into 8x8 blocks and logo.jpg into 2x2 blocks or that is not necessary?
- what does it mean by : "ten times of its strength"? Is that just multiplying by 10?
- 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 Commenti
Jevan Watson
il 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
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!