I am trying to implement LSB watermarking in matlab.But i am getting the error=> Assignment has more non-singleton rhs dimensions than non-singleton subscripts Error in ==> watermarked_image(ii,jj)=bitset(watermarked_image,1,watermark(ii,jj));
1 view (last 30 days)
Show older comments
here is the code=>
clc file1='C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg'; [cover_image,map]=imread(file1); %imshow(cover_image,map);
file2='C:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg'; [message_image]=imread(file2); %imshow(message_image);
message_image=double(message_image); message_image=round(message_image./256); message_image=uint8(message_image);
O=size(cover_image,1) P=size(cover_image,2)
Q=size(message_image,1) R=size(message_image,2)
for ii = 1:O for jj = 1:P watermark(ii,jj)=message_image(mod(ii,Q)+1,mod(jj,R)+1); end end watermark=double(watermark) watermark=round(watermark./256); watermarked_image=cover_image; for ii =1:O for ii= 1:P watermarked_image(ii,jj)=bitset(watermarked_image,1,watermark(ii,jj)); end end
imshow(watermarked_image)
2 Comments
Accepted Answer
Image Analyst
on 5 Oct 2013
Chances are you have 3D true color images. So you need to specify a color channel, as in watermark(row, column, colorChannel), not just the row and column, as in watermark(row, column).
6 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!