function varargout = ladingfang(varargin)
% LADINGFANG M-file for ladingfang.fig
% LADINGFANG, by itself, creates a new LADINGFANG or raises the existing
% singleton*.
%
% H = LADINGFANG returns the handle to a new LADINGFANG or the handle to
% the existing singleton*.
%
% LADINGFANG('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LADINGFANG.M with the given input arguments.
%
% LADINGFANG('Property','Value',...) creates a new LADINGFANG or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ladingfang_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ladingfang_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 ladingfang
% Last Modified by GUIDE v2.5 05-Jan-2005 22:18:40
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ladingfang_OpeningFcn, ...
'gui_OutputFcn', @ladingfang_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 ladingfang is made visible.
function ladingfang_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 ladingfang (see VARARGIN)
% Choose default command line output for ladingfang
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% This sets up the initial plot - only do when we are invisible
% so window can get raised using ladingfang.
if strcmp(get(hObject,'Visible'),'off')
% plot(rand(5));
end
global h1 h2
h1=handles.axes1;
h2=handles.axes2;
%-----------------初始化界面属性
set(handles.edit1,'string','1');
set(handles.edit2,'string','2');
set(handles.edit3,'string','125');
set(handles.pushbutton2,'Visible','off');
G=imread('LENA256.BMP');
set(gcf,'CurrentAxes',h1);
imshow(G);
title('原图像');
set(h2,'Visible','off');
% UIWAIT makes ladingfang wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ladingfang_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;
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 加密函数 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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)
axes(handles.axes1);
cla;
global h1 h2
%------------更新并获取各对象属性
Times = str2num(get(handles.edit1, 'string'));
X= str2num(get(handles.edit2, 'string'));
Y= str2num(get(handles.edit3, 'string'));
popup_sel_index = get(handles.popupmenu1, 'Value');
switch popup_sel_index
case 1
G=imread('lena256.bmp');
set(gcf,'CurrentAxes',h1);
imshow(G);
title('原图像');
%-----验证输入数据的有效性
N = str2double(get(handles.edit1,'String'));
Errstr = '';
if isnan(N) | ~(floor(N) == N) | (N <= 0)
Errstr = '变换次数必须为正整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
D(1) =str2double(get(handles.edit2,'String'));
D(2) =str2double(get(handles.edit3,'String'));
Errstr = '';
if isnan(D(1)) | ~(floor(D(1)) == D(1)) | (D(1) < 1)| (D(1)>255)
Errstr = '参数1必须为1至255正整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
Errstr = '';
if isnan(D(2)) | ~(floor(D(2)) == D(2)) | (D(2) < 1)| (D(1)>255)
Errstr = '参数2必须为1至255正整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
if D(1) == D(2)
Errstr = '参数1与参数2必须不同!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
%-----------验证结束
%-----------计算期间,禁用部分控件
mousefrm(0,'watch');
set(handles.popupmenu1,'enable','off');
set(handles.popupmenu2,'enable','off');
set(handles.edit1,'enable','off');
set(handles.edit2,'enable','off');
set(handles.edit3,'enable','off');
set(handles.pushbutton1,'enable','off');
set(handles.pushbutton2,'enable','off');
%----------------------------------------
set(gcf,'CurrentAxes',h2);
I=G;
[u,v]=zhengjiaodui(X,Y);
zhiluan(I,Times,u,v,1);
title('加密后');
%----------恢复控件的可用性
set(handles.popupmenu1,'enable','on');
set(handles.popupmenu2,'enable','on');
set(handles.edit1,'enable','on');
set(handles.edit2,'enable','on');
set(handles.edit3,'enable','on');
set(handles.pushbutton1,'enable','on');
set(handles.pushbutton2,'enable','on');
mousefrm(0,'arrow');
%--------------------------------------
case 2
G=imread('LENA256.BMP');
set(gcf,'CurrentAxes',h1);
imshow(G);
title('原图像');
%-----验证输入数据的有效性
N = str2double(get(handles.edit1,'String'));
Errstr = '';
if isnan(N) | ~(floor(N) == N) | (N <= 0)
Errstr = '变换次数必须为正整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
D(1) =str2double(get(handles.edit2,'String'));
D(2) =str2double(get(handles.edit3,'String'));
Errstr = '';
if isnan(D(1)) | ~(floor(D(1)) == D(1))
Errstr = '参数1必须为整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
Errstr = '';
if isnan(D(2)) | ~(floor(D(2)) == D(2))
Errstr = '参数2必须为整数!';
end
if ~isempty(Errstr)
errordlg(Errstr);
return
end
%-----------验证结束
mousefrm(0,'watch');
set(gcf,'CurrentAxes',h2);
positiontrans(G,Times,X,Y);
title('加密后');
mousefrm(0,'arrow');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 解密函数 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
cla;
global h1 h2
Times = str2num(get(handles.edit1, 'string'));
X= str2num(get(handles.edit2, 'string'));
Y= str2num(get(handles.edit3, 'string'));
Times = str2num(get(handles.edit1, 'string'));
UNCODE=imread('code.bmp');
set(gcf,'CurrentAxes',h1);
imshow(UNCODE);
title('解密前');
%-----验证输入数据的有效性
N = str2double(get(handles.edit1,'String'));
Errstr = '';
if isnan(N) | ~(floor(N) == N) | (N <= 0)
E
没有合适的资源?快使用搜索试试~ 我知道了~
【图像加密】基于matlab GUI正交拉丁方置乱算法图像加解密【含Matlab源码 182期】.zip
共6个文件
bmp:3个
png:1个
m:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 121 浏览量
2023-10-22
22:34:31
上传
评论
收藏 484KB ZIP 举报
温馨提示
CSDN海神之光上传的代码均可运行,亲测可用,直接替换数据即可,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描博客文章底部QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作 图像加密: DNA混沌图像加密、Arnold置乱图像加密解密、Logistic+Tent+Kent+Hent图像加密与解密、双随机相位编码光学图像加密解密 正交拉丁方置乱图像加密解密、RSA图像加密解密、小波变换DWT图像加密解密、混沌结合小波变换图像加密
资源推荐
资源详情
资源评论
收起资源包目录
【图像加密】基于matlab GUI正交拉丁方置乱算法图像加解密【含Matlab源码 182期】.zip (6个子文件)
【图像加密】基于matlab GUI正交拉丁方置乱算法图像加解密【含Matlab源码 182期】
ladingfang.m 19KB
peppers.BMP 257KB
code.bmp 65KB
ladingfang.fig 33KB
运行结果.PNG 142KB
LENA256.BMP 65KB共 6 条
- 1
资源评论

海神之光
- 粉丝: 6w+
创作灵感
更多 >
上传资源 快速赚钱
我的内容管理
展开
我的资源
快来上传第一个资源
我的收益 登录查看自己的收益
我的积分
登录查看自己的积分
我的C币
登录后查看C币余额
我的收藏
我的下载
下载帮助
前往需求广场,查看用户热搜最新资源
- 如何才能有效利用大语言模型来智能重塑科创平台的科技成果转化路径?.docx
- 如何才能有效利用大语言模型来智能加速产业联盟的产业链转化路径?.docx
- 如何构建并实践AI大模型赋能一站式创新生态科技管理系统?.docx
- 如何构建并实践AI大模型赋能精准产学研合作技术转移中心?.docx
- 如何构建并实践AI大模型赋能高效创新生态科技管理系统?.docx
- 如何构建并实践AI驱动的高效成果转化技术转移中心?.docx
- 如何构建并实践AI驱动的全链条产学研合作技术转移中心?.docx
- 如何构建并实践AI驱动的一站式创新生态供需匹配平台?.docx
- 如何构建并实践数智化闭环式产学研合作科创大脑?.docx
- 如何应用AI大数据于成果转化,实现从_技术定价难_到_高效协同_的转变?.docx
- 如何应用大语言模型于产学研合作,实现从_专利沉睡_到_全链条协同_的转变?.docx
- 如何应用人工智能于产学研合作,实现从_专利沉睡_到_全链条协同_的转变?.docx
- 如何真正以AI大数据为引擎,盘活国央企的技术转移,从而实现高质量发展?.docx
- 如何真正以AI大数据为引擎,提升国央企的科技招商,从而实现高质量发展?.docx
- 如何真正以AI为引擎,盘活产业联盟的技术转移,从而实现高质量发展?.docx
- 如何真正以大语言模型为引擎,赋能产业联盟的创新生态,从而实现高质量发展?.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功