首页 > 行业资讯 > 【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码

【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码

时间:2022-07-29 来源: 浏览:

【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。

收录于合集 #图像处理matlab源码 777个

1 内容介绍

1.1 课题研究的目的和意义 自二十世纪九十年代以来,网络在我们的生活中得到了快速的普及,网络几乎存 在于家家户户中,特别是一些用于交流的软件自诞生以来更是为我们的生活都带来了 极大的便利,让人们的交流变得十分容易。但是网络在便利我们生活的同时,也给网络 安全造成了很大的威胁。比如我们通常利用网络或者多媒体去通信交流或者发送资料, 这种传递方式打破了以往的书信往来,大大便利了人民的生活,但是在这个消息传递过 程中网络上存在的处处可见的安全隐患却不容得我们小觑。比如非法者会通过截获秘 密信息,并对秘密信息进行一定的纂改后发出去,接收者就会接收到错误的信息从而 导致很大的失误,严重的话会对一个企业以及政府机关等等造成毁灭性打击。 为了打击这种利用网络窃密,甚至利用网络盗取国家机密或者企业机密去犯罪的 行为,除了通过公安机构报警处理这种事后处理方法,还应该考虑将这种行为直接在 源头处进行扼杀,所以研究信息安全技术刻不容缓。目前主要的信息安全技术有两种, 一种是传统的信息安全手段加密技术,另一种是新兴的信息安全手段信息隐藏技术[1]。 如今这两种技术均被人们广泛地研究与应用。加密技术的诞生比信息隐藏技术早了很 久,也是最传统的信息安全手段,加密技术是通过将明文进行一系列变换,得到一种完 全看不出明文原始样子的密文,通过将加密后的密文,传送到接收者的手中,接收者再 进行一系列的解密工作来保证信息安全[2]。加密技术的诞生给信息安全领域带来了很大 的突破,但是这种技术也带来一些问题,比如非法者可以完全看到这种加密信息,就会 有目的性地对加密信息进行突破,如果引起非法者的兴趣就会有很大可能被解密或者 被破坏。信息隐藏技术解决了加密技术这个容易被针对的问题,它隐藏了秘密信息的 存在性,使得非法者根本注意不到秘密信息的存在,就不会有针对性地进行攻击。这项 技术通过将秘密信息嵌入在可以公开传播的载体中,但并不改变该公开载体原本的样 子、价值等等,来实现秘密信息的传递[3]。但是,通过隐藏传递的秘密信息一旦被发现, 秘密信息将直接暴露,所以结合用户们对信息安全的这种高隐蔽和高安全的要求,考 虑到要将加密和信息隐藏结合起来[4]。

信息隐藏是一种新兴的信息安全技术,在信息战,数字媒体的知识产权保护和票据防伪等方面有许多重要的应用.但作为一门信息安全领域的学科,对它的安全性一直没有系统的理论研究.我们结合信息隐藏算法的相关知识,对基于图像的空域LSB隐藏算法、DWT变换算法、LHA算法和DCT变换域算法的安全性进行了分析,希望能对安全性的理论研究有所帮助.实验表明,该算法对椒盐、白噪声、滤波、剪切、压缩和旋转等一系列攻击都有较好的稳健性。

2 仿真代码

function varargout = info_hiding_gui(varargin) % INFO_HIDING_GUI M-file for info_hiding_gui.fig % INFO_HIDING_GUI, by itself, creates a new INFO_HIDING_GUI or raises the existing % singleton*. % % H = INFO_HIDING_GUI returns the handle to a new INFO_HIDING_GUI or the handle to % the existing singleton*. % % INFO_HIDING_GUI( ’CALLBACK’ ,hObject,eventData,handles,...) calls the local % function named CALLBACK in INFO_HIDING_GUI.M with the given input arguments. % % INFO_HIDING_GUI( ’Property’ , ’Value’ ,...) creates a new INFO_HIDING_GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before info_hiding_gui_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to info_hiding_gui_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 info_hiding_gui % Last Modified by GUIDE v2.5 05-Jun-2010 19:09:16 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct(’gui_Name’, mfilename, ... ’gui_Singleton’, gui_Singleton, ... ’gui_OpeningFcn’, @info_hiding_gui_OpeningFcn, ... ’gui_OutputFcn’, @info_hiding_gui_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 info_hiding_gui is made visible. function info_hiding_gui_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 info_hiding_gui (see VARARGIN) clc; V=get(0,’screensize’) ;%获取当前根屏幕的大小信息 a=V(3)/2-500; b=V(4)/2-334; set(gcf,’Position’,[a b 1001 669]) % clear; % Choose default command line output for info_hiding_gui handles.output = hObject; % Update handles structure guidata(hObject, handles); set(handles.radiobutton31,’value’,1);%设置噪声攻击的默认值为“无噪声” set(handles.radiobutton32,’value’,1);%设置滤波处理的默认值为“无滤波” set(handles.slider6,’value’,0);%设置滑动条的默认值为0 set(handles.slider7,’value’,0); set(handles.slider8,’value’,0); % set(handles.slider9,’ value ’,0); set(handles.slider10,’value’,0); set(handles.edit8,’string’,0); set(handles.edit9,’string’,0); set(handles.edit10,’string’,0); % set(handles.edit11,’ string ’,0); set(handles.edit12,’string’,0); set(handles.edit15,’string’,0); % key_1=[];%初始化密钥为空 % key_2=[]; % set(handles.edit1,’ string ’,’ ’); % set(handles.edit2,’ string ’,’ ’); % UIWAIT makes info_hiding_gui wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = info_hiding_gui_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 button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) % hObject handle to pushbutton12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) response=questdlg(’确定要关闭此程序?’,’提示对话框’,’关闭’,’取消’,1); if strcmp(’关闭’,response) close(gcf) end % --- Executes on button press in pushbutton13. function pushbutton13_Callback(hObject, eventdata, handles) % hObject handle to pushbutton13 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % msgbox(’ name ’,’ 版权声明 ’,’ string ’,’ Copyright ? 2010-2100 何杰 南京邮电大学 ’ ) V=get(0,’screensize’) ;%获取当前根屏幕的大小信息 a=V(3)/2-234+3; b=V(4)/2-132+70; copyright(’Position’,[a b 468 264])%设置弹出的copyright窗口在屏幕的中间附近位置 % --- Executes on button press in pushbutton14. function pushbutton14_Callback(hObject, eventdata, handles) % hObject handle to pushbutton14 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) V=get(0,’screensize’) ;%获取当前根屏幕的大小信息 a=V(3)/2-151; b=V(4)/2-200+70; thanks(’Position’,[a b 303 403]) % --- Executes on slider movement. function slider6_Callback(hObject, eventdata, handles) % hObject handle to slider6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ Value ’) returns position of slider % get(hObject,’ Min ’) and get(hObject,’ Max ’) to determine range of slider gaussian_slide=get(handles.slider6,’value’); % disp(gaussian_slide) %测试 set(handles.edit8,’string’,gaussian_slide); % --- Executes during object creation, after setting all properties. function slider6_CreateFcn(hObject, eventdata, handles) % hObject handle to slider6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’)) set(hObject,’BackgroundColor’,[.9 .9 .9]); end % --- Executes on slider movement. function slider7_Callback(hObject, eventdata, handles) % hObject handle to slider7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ Value ’) returns position of slider % get(hObject,’ Min ’) and get(hObject,’ Max ’) to determine range of slider salt_slide=get(handles.slider7,’value’); % disp(gaussian_slide) %测试 set(handles.edit9,’string’,salt_slide); % --- Executes during object creation, after setting all properties. function slider7_CreateFcn(hObject, eventdata, handles) % hObject handle to slider7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’)) set(hObject,’BackgroundColor’,[.9 .9 .9]); end % --- Executes on slider movement. function slider8_Callback(hObject, eventdata, handles) % hObject handle to slider8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ Value ’) returns position of slider % get(hObject,’ Min ’) and get(hObject,’ Max ’) to determine range of slider localvar_slide=get(handles.slider8,’value’); % disp(gaussian_slide) %测试 set(handles.edit10,’string’,localvar_slide); % --- Executes during object creation, after setting all properties. function slider8_CreateFcn(hObject, eventdata, handles) % hObject handle to slider8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’)) set(hObject,’BackgroundColor’,[.9 .9 .9]); end % --- Executes on slider movement. function slider9_Callback(hObject, eventdata, handles) % hObject handle to slider9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ Value ’) returns position of slider % get(hObject,’ Min ’) and get(hObject,’ Max ’) to determine range of slider poisson_slide=get(handles.slider9,’value’); % disp(gaussian_slide) %测试 set(handles.edit11,’string’,poisson_slide); % --- Executes during object creation, after setting all properties. function slider9_CreateFcn(hObject, eventdata, handles) % hObject handle to slider9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’)) set(hObject,’BackgroundColor’,[.9 .9 .9]); end function edit8_Callback(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit8 as text % str2double(get(hObject,’ String ’)) returns contents of edit8 as a double gaussian_edit=get(handles.edit8,’string’); % disp(gaussian_slide) %测试 gaussian_edit=str2num(gaussian_edit); if gaussian_edit>0.1||gaussian_edit<0 errordlg(’输入错误,请重输!’) error(); end set(handles.slider6,’value’,gaussian_edit); % --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 slider movement. function slider10_Callback(hObject, eventdata, handles) % hObject handle to slider10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ Value ’) returns position of slider % get(hObject,’ Min ’) and get(hObject,’ Max ’) to determine range of slider speckle_slide=get(handles.slider10,’value’); % disp(gaussian_slide) %测试 set(handles.edit12,’string’,speckle_slide); % --- Executes during object creation, after setting all properties. function slider10_CreateFcn(hObject, eventdata, handles) % hObject handle to slider10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’)) set(hObject,’BackgroundColor’,[.9 .9 .9]); end function edit9_Callback(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit9 as text % str2double(get(hObject,’ String ’)) returns contents of edit9 as a double salt_edit=get(handles.edit9,’string’); % disp(gaussian_slide) %测试 salt_edit=str2num(salt_edit); if salt_edit>0.1||salt_edit<0 errordlg(’输入错误,请重输!’) error(); end set(handles.slider7,’value’,salt_edit); % --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 function edit10_Callback(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit10 as text % str2double(get(hObject,’ String ’)) returns contents of edit10 as a double localvar_edit=get(handles.edit10,’string’); % disp(gaussian_slide) %测试 localvar_edit=str2num(localvar_edit); if localvar_edit>0.1||localvar_edit<0 errordlg(’输入错误,请重输!’) error(); end set(handles.slider8,’value’,localvar_edit); % --- Executes during object creation, after setting all properties. function edit10_CreateFcn(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 function edit11_Callback(hObject, eventdata, handles) % hObject handle to edit11 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit11 as text % str2double(get(hObject,’ String ’)) returns contents of edit11 as a double poisson_edit=get(handles.edit11,’string’); % disp(gaussian_slide) %测试 poisson_edit=str2num(poisson_edit); if poisson_edit>0.1||poisson_edit<0 errordlg(’输入错误,请重输!’) error(); end set(handles.slider9,’value’,poisson_edit); % --- Executes during object creation, after setting all properties. function edit11_CreateFcn(hObject, eventdata, handles) % hObject handle to edit11 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 function edit12_Callback(hObject, eventdata, handles) % hObject handle to edit12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit12 as text % str2double(get(hObject,’ String ’)) returns contents of edit12 as a double speckle_edit=get(handles.edit12,’string’); % disp(gaussian_slide) %测试 speckle_edit=str2num(speckle_edit); if speckle_edit>0.1||speckle_edit<0 errordlg(’输入错误,请重输!’) error(); end set(handles.slider10,’value’,speckle_edit); % --- Executes during object creation, after setting all properties. function edit12_CreateFcn(hObject, eventdata, handles) % hObject handle to edit12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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 pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im_cover global im_message global key_2 get_var_error_expression %判断是否输入密钥 disp(’LSB提取’)%测试 noise myfilter lsb_get % --- Executes on button press in pushbutton8. function pushbutton8_Callback(hObject, eventdata, handles) % hObject handle to pushbutton8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % 调用载体图像、秘密信息图像和密钥的全局变量 global im_cover global im_message global key_2 get_var_error_expression %判断是否输入密钥 disp(’DCT提取’) %测试 noise myfilter dct_get % --- Executes on button press in pushbutton9. function pushbutton9_Callback(hObject, eventdata, handles) % hObject handle to pushbutton9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im_cover global im_message global key_2 get_var_error_expression %判断是否输入密钥 disp(’DWT提取’) %测试 noise myfilter dwt_get % --- 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 im_cover %定义im为全局变量 % 选择载体图片 [filename,pathname]=... uigetfile({’*.bmp’},’选择图片’); % 合成路径+文件名 str=[pathname filename]; % 读取图片 im_cover=imread(str); % 判断是否为灰度图像 % if ndims(im_cover)~=2 % if ~isgray(im_cover) % errordlg(’ 请选择灰度图像作为载体图像 ’); % error(); % end im_cover=uint8(im_cover); set(handles.edit1,’string’,str); % --- 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 im_message %全局变量 % 选择载体图片 [filename1,pathname1]=... uigetfile({’*.bmp’},’选择图片’); % 合成路径+文件名 str=[pathname1 filename1]; % 读取图片 im_message=imread(str); % 判断是否为二维二值图像 % test_message=find(im_message~=0&im_message~=1); % if isempty(test_message) % test_value=0; % else % test_value=1; % end % if ndims(im_message)~=2||test_value % if any(im_message~=0|im_message~=1) % if ~isbw(im_message) % errordlg(’ 请选择二值图像作为秘密信息图像 ’); % error(); % end set(handles.edit2,’string’,str); % --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im_cover global im_message %使全局载体图像的变量 % 判断是否已经选择载体图像和秘密信息图像 if isempty(im_cover) errordlg(’请选择一张图片作为载体图片’,’错误’); error(); end if isempty(im_message) errordlg(’请选择一张图片作为秘密图片’,’错误’); error(); end % if im_message==NULL % errordlg(’ 请选择载体图像 ’); % error(); % end figure subplot(121); imshow(im_cover);title(’载体图像’); subplot(122); imshow(im_message);title(’秘密信息图像’); function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,’ String ’) returns contents of edit1 as text % str2double(get(hObject,’ String ’)) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit 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

3 运行结果

4 参考文献

[1]张大奇, 曲仕茹, 康宝生. 基于DCT和DWT的数字图像隐藏技术[J]. 西北工业大学学报, 2007, 25(3):5.

[2]徐凯. 图像信息隐藏算法研究[D]. 贵州大学.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐