image watermarking using dwt

2 views (last 30 days)
jojototo
jojototo on 25 May 2019
Commented: jojototo on 31 May 2019
I am using the following code to embed an image as a watermark in HL component of the host image "after performing dwt on host image" and I get this error message
""Array dimensions must match for binary array op"" could you help me to fix this problem please?
B = 'Host.png';
rgbhostImage = imread(B);
[f7,f8]= wfilters('haar','d');
[A,V,H,D]= dwt2(rgbhostImage,'haar','d');
[A2,V2,H2,D2]= dwt2(A,'haar','d');
w= imread('watermarkimage.png');
water= imresize(w, [512, 365]);
imwrite(water,'watermarkimage2.png');
watermark= imread('watermarkimage2.png');
%watermarking
wtrmrk= double(watermark);
Q= double(H2);
wtrmrkedimage= Q+0.001*wtrmrk;

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 25 May 2019
Edited: KALYAN ACHARJYA on 25 May 2019
As you didnot provided the sufficient data, but I have figure out, in which line the error occured
I have test the code with different images, the error is same
wtrmrkedimage= Q+0.001*wtrmrk;
% Plese ensure that Q and wtrmrk must have same size
How can you add the two different dimension matrices, debug the code in such that Q and wtrmrk must have same dimention (also type), checked the following way.
>> whos Q
Name Size Bytes Class Attributes
Q 128x128 131072 double
>> whos wtrmrk
Name Size Bytes Class Attributes
wtrmrk 512x365 1495040 double
>>
Check the all variable, so that dimention must agree.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!