function [A,msg] = imagehide(cover,message,goleimage,permission,level)
%提取图像信息并分层
cover = imread(cover,permission);
data = cover;
Msg = imread(message,permission);
[msg,map] = rgb2ind(Msg,0.1);
%msg = im2bw(Msg,0.5);
[row,col] = size(cover);
cover1 = cover(:,:,level);
%置图像R层低4bit为0
for i = 1 : row
for j = 1 : col/3
cover1(i,j) = bitand(cover1(i,j),240);
end
end
%置秘密图像的低4bit为0
takemsg4 = bitand(msg,240);
%将秘密图像的高4bit右移4位
shiftmsg4 = bitshift(takemsg4,-4);
%图像隐藏
for i = 1 : row
for j = 1 : col/3
cover1(i,j) = bitor(cover1(i,j),shiftmsg4(i,j));
end
end
%写回并保存
data(:,:,level) = cover1;
imwrite(data,goleimage,permission);
%提取秘密图像信息,检测隐藏效果
data = imread(goleimage,permission);
[row,col] = size(data)
Matlab隐藏
该博客介绍了如何使用Matlab进行图像隐藏操作,通过提取图像信息并分层,将秘密图像信息嵌入到载体图像的特定层,然后保存并检测隐藏效果。主要涉及图像处理、位运算和数据隐藏技术。
摘要由CSDN通过智能技术生成