フィルターのクリア

how to do watermarking using dct.

4 ビュー (過去 30 日間)
yashi gautam
yashi gautam 2016 年 2 月 1 日
コメント済み: Ragini Gaikwad 2021 年 6 月 14 日
Respected sir,
I have made the following code for watermarking in dct domain.
org_img= imread('lena.jpg');
img4x4 = mat2cell( org_img, size(org_img,1)/2 * ones(1,2), size(org_img,2)/2 * ones(1,2), size(org_img,3) );
% upper left
red_1= img4x4{1,1}(:,:,1);
green_1= img4x4{1,1}(:,:,2);
blue_1= img4x4{1,1}(:,:,3);
%dct to upper left
img1_r= dct2(red_1);
img1_g= dct2(green_1);
img1_b= dct2(blue_1);
%watermark one
w1= imread('cousins.jpg');
wtr_img1= imresize(w1, 1/2);
red1= wtr_img1(:,:,1);
green1= wtr_img1(:,:,2);
blue1= wtr_img1(:,:,3);
%dct to w1
wtr1_r= dct2(red1);
wtr1_g= dct2(green1);
wtr1_b= dct2(blue1);
%embedding of watermark
fimgr1= img1_r+ 0.01*wtr1_r;
fimgg1= img1_g+ 0.01*wtr1_g;
fimgb1= img1_b+ 0.01*wtr1_b;
%combining first block
wimg1= cat(3, fimgr1, fimgg1, fimgb1);
%first output block
rgb1= idct2(wimg1);
imwrite(uint8(rgb1),'DCTWatermarked1.jpg');
figure;imshow(uint8(rgb1));title('Watermarked Image 1');
It shows the error:
Error using .*
Matrix dimensions must agree.
Error in idct (line 74)
y = ifft(W.*bb);
Error in idct2 (line 53)
a = idct(idct(arg1).').';
kindly guide me how to correct it.
  1 件のコメント
Karan Chandra
Karan Chandra 2019 年 4 月 22 日
yashi can you send correct solution? please

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

採用された回答

Walter Roberson
Walter Roberson 2016 年 2 月 1 日
dct2() and idct2() apply strictly to 2 dimensional matrices. Your wimg1 is 3 dimensional (RGB) so you cannot apply idct2 to it.
  4 件のコメント
yashi gautam
yashi gautam 2016 年 2 月 1 日
thanks for the help sir. :)
Ragini Gaikwad
Ragini Gaikwad 2021 年 6 月 14 日
Can you please help on this, how to apply idct and then combine

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by