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 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2013-10-5
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!