这个隐写术提取代码有什么问题?

时间:2017-06-07 20:29:51

标签: matlab extract steganography

我想尝试从之前插入消息的图像中提取消息..但是下面的描述有错误..

此代码提取:

% Read Image Stego
IS = imread('imagestego.bmp');

% Extract RedChannel
RedChannel = IS(:,:,1);

% Convert RedChannel to biner
bitstego = uint8(reshape(dec2bin(RedChannel,8)',1,[]) = '0');
nBitstego = length(bitstego);

% Extraction
extBits = bitget(RedChannel(1:end),1).';
extMessage = char(bin2dec(reshape(int2str(extBits),8,[]).').');

来自提取代码的错误:

>> latihanextract
Error: File: latihanextract.m Line: 8 Column: 55
The expression to the left of the equals sign is not a valid target for an assignment.

这是在代码之前嵌入代码!

coverImage = imread('foto1.jpg');
message = 'IMRON';

%EMBEDDING
RedChannel = coverImage(:,:,1);
GreenChannel = coverImage(:,:,2);
BlueChannel = coverImage(:,:,3);
bits = uint8(reshape(dec2bin(message,8)',1,[]) - '0');
nBits = length(bits);
RedChannel(1:nBits) = bitset(RedChannel(1:nBits),1,bits);
Imageresults = cat(3,RedChannel,GreenChannel,BlueChannel);
imwrite(Imageresults,'imagestego.bmp');

那么问题是什么?

1 个答案:

答案 0 :(得分:6)

这是你的问题......

$.each(json_resource, function(index,value){

  var businessHours = { 
    dow: [ value.dow ], 
    start: value.start, 
    end: value.end 
  }

  // GET RESOURCE OBJECT
  var resourceObject = $('#calendar').fullCalendar( 'getResourceById', value.resourceId );

  // ADD NEW BUSINESS WORKING HOUR
  resourceObject.businessHours = businessHours;

  // UPDATE HOURS
  $('#calendar').fullCalendar( 'option', 'resources', resourceObject);

});

您试图循环覆盖图像中的位数而不是字节数。 % Read Image Stego IS = imread('stegosaurus.bmp'); % Extract RedChannel RedChannel = IS(:,:,1); % Convert RedChannel to binary bitstego = uint8(reshape(dec2bin(RedChannel,8)',1,[]) - '0'); nBitstego = length(bitstego); % the previous 2 lines are actually unnecessary and can be deleted... % see explanation in text below % Extrication extBits = bitget(RedChannel(1:end),1).'; % (1:end) gives you all of the elements extMessage = char(bin2dec(reshape(int2str(extBits),8,[]).').') bitstego中所有字节的二进制表示,因此bitstegobitstego的8倍。

在这种情况下,使用特殊索引RedChannel获取RedChannel中的元素数量要容易得多。