Function 'subsindex' is not defined for values of class 'struct'. Error in decoder_test (line 18) binpix= de2bi(stego(key(i)),8);
显示 更早的评论
I have the following dencoder code for a Stegonagraphy assignment. but I keep getting the following error
*Function 'subsindex' is not defined for values of class 'struct'.
Error in decoder_test (line 18)
binpix= de2bi(stego(key(i)),8);*
%decoder program
%load image and key to decode
stego = imread('stegoimmage.tif');
key = load('key.mat');
%decode the image by retrieving the LSB
for i=1:8
%
binpix= de2bi(stego(key(i)),8);
% going to change the 1st significant bit with the 1st bit of our message
binpix(1)=binmessage(i);
%puts the new value back into the original location of were the number was
%removed. converts it to decimal first before it puts it back
stego(key(i))=bi2de(binpix);
end
%conversions
ascmessage = bi2de(binmessage);
message = uint8(ascmessage);
%display the hidden message
I need to be able to retrieve the hidden message from the picture. but cant get past this message. please help
回答(2 个)
Steven Lord
2016-2-29
0 个投票
The variable key is a struct array. MATLAB doesn't know how to use a struct array as an index; you need to extract the data from one of the fields of key and use that data to index into stego.
Guillaume
2016-2-29
key = load('key.mat')
This will create a structure key with fields named after each variable in the 'key.mat' file. Without seeing the mat file, it's impossible for us to tell you the names of the fields of that structure. And even then, we would need to know which variable in the mat file you want to use as index
Possibly, if your mat file contains the variable key that you want to use as index, this would work:
matcontent = load('key.mat');
key = matcontent.key;
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!