image watermarking using dwt

1 次查看(过去 30 天)
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;

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-5-25
编辑:KALYAN ACHARJYA 2019-5-25
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.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by