function varargout = NumTest(varargin)
% NUMTEST MATLAB code for NumTest.fig
% NUMTEST, by itself, creates a new NUMTEST or raises the existing
% singleton*.
%
% H = NUMTEST returns the handle to a new NUMTEST or the handle to
% the existing singleton*.
%
% NUMTEST('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in NUMTEST.M with the given input arguments.
%
% NUMTEST('Property','Value',...) creates a new NUMTEST or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before NumTest_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to NumTest_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 NumTest
% Last Modified by GUIDE v2.5 25-Apr-2019 08:57:22
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @NumTest_OpeningFcn, ...
'gui_OutputFcn', @NumTest_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 NumTest is made visible.
function NumTest_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 NumTest (see VARARGIN)
% Choose default command line output for NumTest
handles.output = hObject;
global C;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes NumTest wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = NumTest_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 mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 鼠标点击
set(handles.axes1,'XLim',[0,1],'YLim',[0,1]);
global draw_enable;
global x;
global y;
draw_enable=1;
if draw_enable
position=get(gca,'currentpoint');
x(1)=position(1);
y(1)=position(3);
end
% --- Executes on mouse motion over figure - except title and menu.
function figure1_WindowButtonMotionFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 鼠标移动
global draw_enable;
global x;
global y;
if draw_enable
position=get(gca,'currentpoint');
x(2)=position(1);
y(2)=position(3);
line(x,y,'LineWidth',9,'color','k','LineStyle','-','Marker','.','Markersize',20); % 线条参数 'EraseMode','xor',warning
x(1)=x(2);
y(1)=y(2);
end
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonUpFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 鼠标松开
global draw_enable
draw_enable=0;
% --- 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)
% 保存图像
[f,p]=uiputfile({'*.bmp';'*.jpg';'*.tif';'*.*'},'Save','..\NumDemo\save');
str=strcat(p,f);
pix=getframe(handles.axes1); %获取坐标区的帧
imwrite(pix.cdata,str,'bmp')
cla(handles.axes1);
% --- 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)
cla(handles.axes1); %清空坐标区axes1
% --- 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 C; %标识是否打开图片,用于后续区分图像来源
C=1;
[filename,pathname]=uigetfile({'*.bmp';'*.jpg';'*.tif';'*.*'},'载入图像','..\NumDemo\save');
if isequal(filename,0)|isequal(pathname,0)
errordlg('没有选中文件','出错');
C=0;
return;
else
file=[pathname,filename];
handles.S=file; %设置新句柄结构体S,保存手写图像路径,以便之后的操作
x=imread(file);
set(handles.axes2,'HandleVisibility','ON');
axes(handles.axes2);
imshow(x);
handles.img=x;
guidata(hObject,handles);
end
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
% --- 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)
close; %关闭对话框
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles) %字母识别
% % hObject handle to pushbutton5 (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% % 由handles.C判断从何处读取图像
global C;
if(C==1)
S=handles.S;
X=imread(S); %读取显示框已打开的图片
else
pix=getframe(handles.axes1); %获取坐标区的帧
X=frame2im(pix); %转换成图片
end
C=0;
if numel(size(X))>2 %判断是灰度图还是彩色图像
Img=rgb2gray(X); %将彩色图像转换为灰度图像
else
Img=X;
end
bw = edu_imgcrop(Img); %裁剪图像
curFeature = edu_imgresize(bw); %提取特征
Label=LetIdentify(curFeature); %判决识别
%
咸鱼大圣
- 粉丝: 8
- 资源: 7
最新资源
- 西门子s7 200smart与3台英威腾GD变频器通讯实战程序 原创可直接用于生产的程序,程序带注释,并附送触摸屏程序,有接线方式和设置,通讯地址说明等 程序采用轮询,可以后续根据要求适当修
- 标签打印C#控制程序源代码,适合自己进行二次开发 软件可以自己编辑标签,可以自动条形码或二维码的位置
- 松下FP-XHC60T 标准可带18轴中型程序,总共逻辑1万多步,含昆仑通态触摸屏程序(触摸屏附带配方功能,以及产能统计:), 项目功能完整主站与两个从站采用PLC链接通讯,该程序为标准框架,故障,复
- WPF智慧工厂数据平台 1, 提供一个智慧工厂数据平台框架 2,理解wpf的设计模式 3,学习如何绘制各种统计图 4,设计页面板块划分 5,如何在适当时候展现动画 有盆友问,这个是否带数据库
- yolo目标检测数据-抽烟、打电话、打哈欠数据集5665张含yolo标签文件(可用于疲劳检测、司机行为检测).zip
- FLAC3D锚杆辅助生成软件根据CAD图自动打锚杆 使用感受 在CAD画出锚杆,启动软件会生成锚杆命令流,call入flac中即可或者复制到自己命令流中,十分便捷 由于开发成软件,永久使用
- 施耐德ATV71原厂纸质原理图纸 施耐德ATV71变频器原理图纸,可以用来研究变频器电路的结构组成、控制原理,为搞清楚变频电路的控制原理、信号的来龙去脉提供科学依据,更能够做为变频器
- 信捷XC PLC与3台施耐德ATV12变频器通讯程序 信捷XC PLC与3台施耐德ATV12变频器通讯,可靠稳定,同时解决施耐德ATV12变频器断电重启后,自准备工作,无需人为准备 器件:信捷XC3
- 电动自行车方案,资料齐全 成熟电动自行车代码方案,学习好资料 中颖中颖电动自行车代码方案,包含代码,原理图,pcb,说明文档 不论是学习电动车代码还是学习电流环,速度环,Pid调节,都是很好
- 三菱PLC FX5U 伺服机器人程序 包括三菱FX5U程序,威纶通触摸屏程序,IO表,材料清单,eplan和PDF电气图 4轴伺服程序,1个机器人,FX5U结构化编程
- 电机启动模型 Matlab simulink 可用于模拟电压暂降等电能质量问题,适配于本家的IEEE 33节点模型
- python入门-外星人小游戏
- 高压大功率电动汽车360V方案 电动汽车高压电机控制器360v乘用车平台,某知名电控厂家主推 产品,软件源代码,软件FOC矢量控制算法,boot源码,全部开源,强大的上位机调试工具带实时波形显示,原理
- matlab 多智能体系统编队控制仿真,非线性,一致性,领导跟随控制,有限时间控制等
- 蛋白质功能预测中的深度学习方法:结合序列与互作网络的深层分类模型(DeepGO)
- 三菱纯水设备程序纯水设备程序 使用三菱A系列 PLC和三菱A985GOT触摸屏,也可以额外有偿转移指其他触摸屏,比如昆仑通态和威纶通还有信捷等等
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈