[プロジェクト] MATLAB GUILSB音声信号に基づく電子透かし[Matlabソースコード619を含む]

1.はじめに

1 LSBアルゴリズムの概要
LSBは最下位ビット(最下位ビット)と呼ばれ、シンプルで効果的なデータ隠蔽技術です。LSBステガノグラフィの基本的な方法は、キャリア画像の最下位ビットを埋め込まれる秘密情報に置き換えることです。元の画像の上面と秘密情報を表す最下位面は、隠された情報を含む新しい画像を形成します。
ここに画像の説明を挿入
グレースケール画像は、ピクセルをシングルチャネル形式で格納し、各ピクセルの値は0〜255であり、ピクセルのビットプレーンはバイナリピクセルの各ビットに対応します。上の写真を例にとると、特定のピクセルの値は78、そのバイナリ値は01001110、ビットの重みは左から右に減少します。左端のビットが最上位ビットです(MSB、ビットの重みは2 7 2 ^ 72
7
)、および右端のビット最下位ビット(LSB、ビットの重みは2 0 2 ^ 02
0
)。各ピクセルの同じビットが抽出されて、画像のいわゆるビットプレーンである新しいプレーンが形成されます。LSBステガノグラフィアルゴリズムは、その名前が示すように、最下位ビットプレーンであるLSBに情報を埋め込み/非表示にします。

注意すべき点の1つは、LSBが埋め込まれている場合、キャリア画像形式はグレースケール画像形式である必要があるということです。

有名なレナ画像を例にとると、以下はグレースケール画像レナの元の画像です。
ここに画像の説明を挿入
以下は、左から右、上から下へのさまざまなビットプレーン
ここに画像の説明を挿入
画像であり、ビットプレーンは順番に減少します。ビットプレーンが高いほど、元の画像情報が含まれていることがわかります。画像のグレー値への寄与が大きいほど、隣接するビット間の相関が強くなり、その逆も同様です。LSBの最下位ビットプレーンには、ランダムノイズ/ノイズと同様に、基本的に画像情報が含まれていないため、ここに透かし/秘密情報を入力できます。

埋め込み図は次のとおりです。埋め込みに
ここに画像の説明を挿入
異なるビットプレーンを選択する場合、LSBアルゴリズムの忠実度:
ここに画像の説明を挿入2アルゴリズムの原理
一般的に、表示される画像は小さなピクセルで構成され、すべてのピクセルが一緒に配置されて大きな正方形を形成します。 、この大きな正方形は私たちが見る画像です。グレースケール画像(つまり、通常は白黒画像と呼ばれるもの)は、1層のピクセルで構成され、カラー画像は3層のこのようなグレースケール画像で構成されます。グレースケール画像の例を示します。画像に白黒が表示されるのは、各ピクセルのピクセル値が異なるためです。0は純粋な黒を意味し、255は純粋な白を意味し、灰色はこれら2つの数値の間の値で構成されます。0に近いほど暗くなり、255に近づくほど白くなります。では、なぜ0と255なのですか?コンピュータはバイナリであるため、ピクセルを表すために8ビットを使用します(より多くのビットを使用することもできるため、画像のカラーグレーディングがより多くなり、画像もより多くのスペースを占有しますが、一般の人々の目は普通の人と違うのでなければ、あまり多くの色を認識できないので、最大値は255、最小値は0です。lsbは、人間の目があまり正確な色や明るさのパーセプトロンではないため、バイナリシステムの機能に基づいて情報を非表示にします。したがって、ピクセルのグレーレベル1を上下に微調整しても、人間の目は気づきません。つまり、変更します。 8.バイナリコードの最小ビット。画像の各ピクセルの最後のビットを私たちのアイデアに従って変更すると、必要な情報が表示されますが、ユーザーはそれを見ることができず、画像の内容にも影響しません。これはlsb電子透かしです。
3 LSBアルゴリズムの基本特性:
LSBは大容量のデータ隠蔽アルゴリズム
です。LSBの堅牢性は比較的劣ります(ステゴ画像がノイズ、不可逆圧縮などの信号処理に遭遇した場合に使用されます)。埋め込み情報を抽出する場合。不可逆)
4一般的なLSBアルゴリズムの埋め込み方法:
秘密情報は最後まで最下位ビット平面に継続的に埋め込まれ、残りの部分は処理されません(通常のソフトウェアMandelSteg)。
秘密情報は継続的に埋め込まれます。最下位ビット平面で最後まで、残りの部分はランダム化されます(砂漠化処理とも呼ばれ、典型的なソフトウェアPGMStealth)
秘密情報は最下位ビットプレーンに連続的に埋め込まれ、一度は下位プレーンに埋め込まれ、同時に最下位ビットプレーンに埋め込まれ、2次下位プレーンの
秘密情報は最下位ビットプレーンに埋め込まれるため、最下位ビットプレーンは次のようになります。再埋め込み後に完全に埋め込まれる埋め込み時間
の最下位の秘密情報の下位プレーンビットプレーンへのランダム埋め込み
上記の5つの方法では、埋め込み容量が異なると、堅牢性が異なります。

第二に、ソースコード

function varargout = untitled1(varargin)
% UNTITLED1 M-file for untitled1.fig
%      UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
%      singleton*.
%
%      H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
%      the existing singleton*.
%
%      UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in UNTITLED1.M with the given input arguments.
%
%      UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before untitled1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to untitled1_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help untitled1

% Last Modified by GUIDE v2.5 21-Nov-2012 21:12:41

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @untitled1_OpeningFcn, ...
                   'gui_OutputFcn',  @untitled1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{
    
    1})
    gui_State.gui_Callback = str2func(varargin{
    
    1});
end

if nargout
    [varargout{
    
    1:nargout}] = gui_mainfcn(gui_State, varargin{
    
    :});
else
    gui_mainfcn(gui_State, varargin{
    
    :});
end
% End initialization code - DO NOT EDIT


% --- Executes just before untitled1 is made visible.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to untitled1 (see VARARGIN)

% Choose default command line output for untitled1
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = untitled1_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{
    
    1} = handles.output;


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{
    
    get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
%        contents{
    
    get(hObject,'Value')} returns selected item from popupmenu2


% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global fs;
global x1;
global xmax;
global t1;
global l1;
var=get(handles.popupmenu2,'value');
switch var
    case 1
        [x1,fs]=audioread('music1.wav'); 
        cy2=x1(:,1);
    case 2
        [x1,fs]=audioread('music2.wav'); 
  
end
%从底部到顶部,底部的平面有更惊喜的灰度细节,而高阶的比特平面则包含了大多数的数据。而比特分层的实现就是依靠阈值处理函数:
xmax=max(abs(x1));                          %计算最大幅度
xmin=min(abs(x1));                          %计算最小幅度
l1=size(x1);                                %计算出载频的总长度l1,便于FFT分析频谱
t1=(0:length(x1)-1)/fs;
y1=fft(x1,fs);                              %对信号做FFT变换
f=fs*(0:8191)/fs;
axes(handles.axes1);
plot(t1,x1)                                  %做原始语音信号的时域图形
grid on;axis tight;
title('原始语音信号');
xlabel('time(s)');
ylabel('幅度');
axes(handles.axes2);
plot(f,abs(y1(1:8192)))                      %做原始语音信号的FFT频谱图
grid on;axis tight;
title('原始语音信号FFT频谱')
xlabel('HZ');
ylabel('幅度');
sound(x1)

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global fs;
global x1;
global sy;
global lhsy;
global lhx1;
global qrh;
global QRH;
global xmax;
global symax;
global l1;
global l2;
global t1;
global t2;
global qshuiyin;
global Qshuiyin;
var=get(handles.popupmenu1,'value');
switch var
    case 1
        [sy,fs]=audioread('shuiyin1.wav');
    case 2
        [sy,fs]=audioread('shuiyin2.wav');
  
end

3、実行中の結果

ここに画像の説明を挿入

四、備考

QQ 1564658423を追加するために、コードを完成させるか、記述してください

おすすめ

転載: blog.csdn.net/TIQCmatlab/article/details/115184794