Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 图像隐写术-在图像中隐藏图像_Matlab_Steganography - Fatal编程技术网

Matlab 图像隐写术-在图像中隐藏图像

Matlab 图像隐写术-在图像中隐藏图像,matlab,steganography,Matlab,Steganography,在显示图3后,此代码出现问题。这两个图像没有被添加。如何纠正?此程序在封面图像文件名中读取的封面图像的低位平面中隐藏消息图像 %covername = input('Enter image file name with extension (like jennifer.bmp): ', 's'); %read in message image filename %messagename = input('Enter message image file name with extension

在显示图3后,此代码出现问题。这两个图像没有被添加。如何纠正?此程序在封面图像文件名中读取的封面图像的低位平面中隐藏消息图像

%covername = input('Enter image file name with extension (like jennifer.bmp): ', 's'); 
%read in message image filename 
%messagename = input('Enter message image file name with extension: ', 's'); 
%open cover and message image files 
cover = imread('hand.jpg'); 
message = imread('coins.png'); 
%display on screen the two images 
figure(1), imshow(cover); title('Original Image (Cover Image)'); 
figure(2), imshow(message);title('Image to Hide (Message Image)'); 
%change to double to work with addition below 
cover=double(cover); 
message=double(message); 
%imbed = no. of bits of message image to embed in cover image 
imbed=4; 
%shift the message image over (8-imbed) bits to right 
messageshift=bitshift(message,-(8-imbed)); 
%show the message image with only embed bits on screen 
%must shift from LSBs to MSBs 
showmess=uint8(messageshift); 
showmess=bitshift(showmess,8-imbed); 
figure(3),imshow(showmess);title('4 Bit Image to Hide'); 
%now zero out imbed bits in cover image 
coverzero = cover; 
for i=1:imbed 
coverzero=bitset(coverzero,i,0); 
end 
cove=uint8(coverzero);
%now add message image and cover image 
stego = imadd(cove,messageshift); 
figure(4),imshow(stego);title('Stego image'); 
%save files if need to
%4 bit file that was embedded = same as file extracted 
imwrite(showmess,'showmess4.bmp');           
%use bmp to preserve lower bits
%jpg will get rid of them
%stego file imwrite(stego,'stego4.bmp');

我相信你的问题是imadd给了你一个错误“X和Y必须具有相同的大小和类,或者Y必须是一个标量双精度”。这暗示您的图像不相似

如果您执行
谁的cove messageshift
,您将看到cove是类uint8,而messageshift是双精度的。只需将messageshift转换为第16行中的uint8,就像您对cove所做的那样:

messageshift=uint8(位移位(message,-(8-imbed))