2
new_img = convert(img, text);
(img, text) = convert_back(new_img);

誰かがMATALBの組み込み画像で説明できますか?

4

1 に答える 1

7

ステガノグラフィをお探しだと思います。LSBステガノグラフィのこのMATLAB実装から始めることができます。

LSBステガノグラフィを実行する簡単な方法は、可逆圧縮画像を取得し、各コンポーネント(R、G、B)のLSBを設定することです。次に、m x nイメージの場合、情報を格納するために3mnビットを取得します。LSBを変更しているため、イメージに違いは認識されません。

アップデート

そこで、小さくて非効率的ですが、実証的な例をコーディングすることにしました。

function LSBStega    
        %%// Image and text
        I = imread('coins.png');
        text = 'Hello World etc';
        assert(numel(I) > numel(text)*8,'Insufficient number of pixels');

        %%// Encode
        %// The end character signifies the end of the hidden text
        end_char = '.';
        %// Append it
        text = [text end_char];
        %// Convert each character into binary form with atleast 8 bits
        %// We transpose it before calling (:) since the binary representation
        %// is stores each character in binary per row and the (:) operations
        %// vectorizes the matrix by column.
        b = transpose(dec2bin(text,8));
        %// Find which bits should be set to 1 or 0
        ind_0 = find(b == '0');
        ind_1 = find(b == '1');
        %// Set the appropriate bits to 1 and 0 and leave the rest alone
        I(ind_0) = bitset(I(ind_0),1,0);
        I(ind_1) = bitset(I(ind_1),1,1);

        %%// Faster decode
        text_back = [];        
        for i = 1:8:numel(I)
            %// Extract the LSB from a set of 8 bytes in the image
            C = bitget(I(i:i+7),1);
            %// Convert from binary to decimal
            C = bin2dec(num2str(C));
            %// Check if it's the end character; break if so, store if not
            if(C == end_char) 
                break;
            else
                text_back(end+1) = C;
            end
        end
        %// Convert to text
        text_back = char(text_back);

        %%// Display
        subplot(1,2,1);
        title('Original');
        imshow(imread('coins.png'));
        subplot(1,2,2);
        title('Steganography Result');
        imshow(I);
        disp(text_back);    
end
于 2010-04-25T03:30:30.970 に答える