单片机的U盘读写模块的设计(6)

2019-04-09 12:21

唐 山 学 院 毕 业 设 计

end

handles.isSameSizeIJ=strcmp(handles.ImsizeI,handles.ImsizeJ); if handles.isSameSizeIJ~=1

errordlg('请选择相同尺寸的图像','错误') error('配准图像大小不同') end

guidata(hObject,handles);

handles.edit1visible=get(handles.edit1,'visible'); handles.edit2visible=get(handles.edit2,'visible'); edit1visible=strcmp(handles.edit1visible,'on'); edit2visible=strcmp(handles.edit2visible,'on'); % if handles.edit2visible=='on'

% error:Array dimensions must match for binary array op. if edit1visible==1

handles.edit1string=get(handles.edit1,'string'); %handles.var1=str2num(handles.edit1string{1}); handles.var1=str2num(handles.edit1string); end

if edit2visible==1

handles.edit2string=get(handles.edit2,'string'); %handles.var2=str2num(handles.edit2string{1}); handles.var2=str2num(handles.edit2string); end

switch handles.OAname case 'PSO'

out=PSO(handles); case 'POWELL'

out=POWELL(handles); end

handles.out=out; x=out(1); y=out(2); ang=out(3); miValue=out(4);

FinalResult=['X,Y,Angle=',num2str(x)

',',num2str(y)

21

',',num2str(ang),'

唐 山 学 院 毕 业 设 计

MI_Value=',num2str(miValue)]; axes(handles.axes1)

Q=restore(handles); % imshow(Q) set(handles.text6,'string',FinalResult); % --- Executes on button press in pushbutton2.

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) clc

ValueI.ss.IsImage=0;

while ValueI.ss.IsImage==0 ValueI=testListBoxlj; end

delete(ValueI.figure1);

handles.ImsizeI=ValueI.ss.imsize; handles.filenameI=ValueI.ss.filename; handles.names_dispI=ValueI.ss.names_disp; set(handles.text7,'String',handles.names_dispI); axes(handles.axes2) I=imread(handles.filenameI); imshow(I)

guidata(hObject, handles);

% --- 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) clc

ValueJ.ss.IsImage=0;

while ValueJ.ss.IsImage==0 ValueJ=testListBoxlj; end

delete(ValueJ.figure1);

22

唐 山 学 院 毕 业 设 计

handles.ImsizeJ=ValueJ.ss.imsize; handles.filenameJ=ValueJ.ss.filename; handles.names_dispJ=ValueJ.ss.names_disp; set(handles.text8,'String',handles.names_dispJ); axes(handles.axes3) J=imread(handles.filenameJ); imshow(J)

guidata(hObject, handles);

%对图像进行平移和旋转 close all; clear; clc;

%J=imread('CTcankao1.jpg'); J=imread('CTcankao1.jpg');

se = translate(strel(1), [30 20]); J = imdilate(I,se); J = imrotate(J,45,'nearest','crop'); imshow(J); figure; imshow(I); %选择图像界面

function varargout = testListBoxlj(varargin) % TESTLISTBOXLJ M-file for testListBoxlj.fig

% TESTLISTBOXLJ, by itself, creates a new TESTLISTBOXLJ or raises the existing

% singleton*.%

% H = TESTLISTBOXLJ returns the handle to a new TESTLISTBOXLJ or the handle to

% the existing singleton*.

% TESTLISTBOXLJ('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TESTLISTBOXLJ.M with the given input arguments.

% TESTLISTBOXLJ('Property','Value',...) creates a new TESTLISTBOXLJ or raises the

% existing singleton*. Starting from the left, property value pairs are % applied to the GUI before testListBoxlj_OpeningFunction gets called. An

23

唐 山 学 院 毕 业 设 计

% unrecognized property name or invalid value makes property application % stop. All inputs are passed to testListBoxlj_OpeningFcn via varargin. % *See GUI Options on GUIDE's Tools menu. Choose \% instance to run (singleton)\

% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help testListBoxlj % Last Modified by GUIDE v2.5 19-Sep-2005 10:36:50 % Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @testListBoxlj_OpeningFcn, ... 'gui_OutputFcn', @testListBoxlj_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 testListBoxlj is made visible.

function testListBoxlj_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 testListBoxlj (see VARARGIN) % Choose default command line output for testListBoxlj handles.output = hObject; % Update handles structure

24

唐 山 学 院 毕 业 设 计

guidata(hObject, handles); % if nargin == 3, % initial_dir = pwd; % elseif nargin > 4

% if strcmpi(varargin{1},'dir') % if exist(varargin{2},'dir') % initial_dir = varargin{2}; % else

% errordlg('Input argument must be a valid directory','Input Argument Error!')

% return % end % else

% errordlg('Unrecognized input argument','Input Argument Error!'); % return; % end % end

initial_dir = pwd;

ss=load_listbox(initial_dir,handles); handles.ss=ss;

% UIWAIT makes testListBoxlj wait for user response (see UIRESUME) % handles.parhandles=varargin{1}; guidata(handles.figure1, handles); % while handles.ss.IsImage==0 uiwait(handles.figure1); % handles.figure1 % handles.ss.IsImage % end

% --- Outputs from this function are returned to the command line. function varargout = testListBoxlj_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)

25


单片机的U盘读写模块的设计(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:7-发扬百年公学优良传统,创办一流精品特色小学

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: