Image Watermarking Using DCT

Hello im new to mathlab and doing image watermarking using dct method, but im facing this problem can anyone help me:( im a very beginner:(
clc;
clear all
I=imread('Sunset.jpg'); I=imresize(I,[300 300]);
if size(I,3)==3
I=rgb2gray(I);
end
figure,imshow(I), title('CITRA Penampung')
W=imread('copyright1.png'); I=imresize(W,[300 300]);
if size(W,3)==3
W=rgb2gray(W);
end
figure,imshow(W), title('CITRA Watermark')
alpha = 0.02;
A = dct2(double(I));
B = dct2(double(W));
C = A + alpha*B;
Iw = round(real(idct2(C)));
IIw = uint8(Iw)
figure,imshow(IIw), title('CITRA Terwatermark')
I=imread('Sunset.jpg'); I=imresize(I,[300 300]);
if size(I,3)==3
I=rgb2gray(I);
end
A=dct2(double(I));
C1=dct2(double(Iw));
B1=(C1-A)./alpha;
W1=uint8(idct2(B1));
figure,imshow(W1), title('CITRA Watermark Hasil Ekstraksi')
%this is the error I get
Matrix dimensions must agree.
Error in dct (line 76)
b = W .* fft(y);
Error in dct2 (line 49)
b = dct(dct(arg1).').';
Error in dctcoba (line 17)
A = dct2(double(I));

3 件のコメント

Walter Roberson
Walter Roberson 2019 年 9 月 15 日
Put in a breakpoint at the beginning of the assignment to A and run the code. What shows up for size(A)?
Cua Domain
Cua Domain 2021 年 3 月 25 日
did you solve this? please help me
Walter Roberson
Walter Roberson 2021 年 3 月 25 日
Cua, if you are encountering this problem, please show us size() of what you pass to dct2

サインインしてコメントする。

回答 (0 件)

製品

リリース

R2017a

質問済み:

2019 年 9 月 15 日

コメント済み:

2021 年 3 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by