how to solve the problem of matrices dimension must agree

7 ビュー (過去 30 日間)
OLUFEMI SONEYE
OLUFEMI SONEYE 2019 年 5 月 25 日
コメント済み: Image Analyst 2019 年 5 月 25 日
Hello, i need an assistance on how to add two variables/matrices in my code below. one is w_LL(256x256x3 double) and the other is Ir_LL(256x256 double).Attached is the code.Thank you.
CODE------------------
t=0.10;
newhost_LLr =Ir_LL+(t*w_LL);
r2=idwt2(newhost_LLr,Ir_LH,Ir_HL,Ir_HH,'haar');
figure(2);imshow(uint8(r2));title('Watermarked image of r component');
newhost_LLg =Ig_LL+(t*w_LL);
g2=idwt2(newhost_LLg,Ig_LH,Ig_HL,Ig_HH,'haar');
figure(2);imshow(uint8(g2));title('Watermarked image of g component');
newhost_LLb =Ib_LL+(t*w_LL);
b2=idwt2(newhost_LLb,Ib_LH,Ib_HL,Ib_HH,'haar');
figure(2);imshow(uint8(r2));title('Watermarked image of g component');
%imwrite(uint8(rgb2),'images/Watermarked33.jpg');

採用された回答

Image Analyst
Image Analyst 2019 年 5 月 25 日
Make it an RGB image also
rgbImage = cat(3, Ir_LL, Ir_LL, Ir_LL);
newhost_LLr = rgbImage + (t * w_LL);
  3 件のコメント
OLUFEMI SONEYE
OLUFEMI SONEYE 2019 年 5 月 25 日
This is the modified version of the code after your contribution---------------------
t=0.10;
R = cat(3, Ir_LL, Ir_LL, Ir_LL);
newhost_LLr = R + (t * w_LL);
%newhost_LLr =Ir_LL+(t*w_LL);
r2=idwt2(newhost_LLr,Ir_LH,Ir_HL,Ir_HH,'haar');
figure(2);imshow(uint8(r2));title('Watermarked image of r component');
G = cat(3, Ig_LL, Ig_LL, Ig_LL);
newhost_LLr = G + (t * w_LL);
%newhost_LLg =Ig_LL+(t*w_LL);
g2=idwt2(newhost_LLg,Ig_LH,Ig_HL,Ig_HH,'haar');
figure(2);imshow(uint8(g2));title('Watermarked image of g component');
B = cat(3, Ib_LL, Ib_LL, Ib_LL);
newhost_LLr = B + (t * w_LL);
%newhost_LLb =Ib_LL+(t*w_LL);
b2=idwt2(newhost_LLb,Ib_LH,Ib_HL,Ib_HH,'haar');
figure(2);imshow(uint8(b2));title('Watermarked image of g component');
%imwrite(uint8(rgb2),'images/Watermarked33.jpg');
It popped error on line 4 at the point of finding the idwt. I will appreciate your more contributions. Thank you.
Image Analyst
Image Analyst 2019 年 5 月 25 日
Sorry - I don't have the Wavelets toolbox so I can't help you on the idwt2() function. Make sure what kind of image (color or gray scale) you're supposed to pass it.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDisplay and Exploration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by