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 ==> watermarke​d_image(ii​,jj)=bitse​t(watermar​ked_image,​1,watermar​k(ii,jj));

1 view (last 30 days)
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)

Accepted Answer

Image Analyst
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
Urmila
Urmila on 7 Oct 2013
Hello sir,when i tried to attach the images then i got message =>
You are limited to 10 daily uploads. If you need to upload additional files, delete one or more files now or wait 24 hours to upload more files.
Is it means that i have already attached some images?If yes then why i cant see it?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!