我想在这里提出一个问题。我的问题是我想将每个字符的2 LSB嵌入到2 * 2矩阵中并连续嵌入,直到数据成功嵌入全部。但现在我无法做到。非常感谢您的帮助。这是我的代码部分。
fid = fopen('test.txt'); %open the text file
readText = fread(fid);
fclose(fid); %close the file function
char_in_bit = uint8(readText);
ascii_binary = dec2bin(char_in_bit,7);
size_char = size(char_in_bit); %determine the length of the text file
display(char_in_bit);
display(size_char);
display(BlockRONI);
display(ascii_binary);
for a=1 : size(ascii_binary,1)
for b=1:6
if blocksize==2
n=1;
for r=1:2
for c=1:2
block(r,c)=bitset(block(r,c),1,char_in_bit(n));
n=n+1;
block(r,c)=bitset(block(r,c),2,char_in_bit(n));
%display(block(r,c));
end
end
end
end
block(r,c) = bitset(block(r,c), 7, char_in_bit(n));
end
watermarked_image(y2:y2+blocksize-1, x2:x2+blocksize-1)=block;
watermarked_image_int=uint8(watermarked_image);
imwrite(watermarked_image_int,'watermarked.jpg');