matlab手写输入,基于matlab的手写输入板

本文介绍了如何使用Matlab构建一个手写数字输入面板,包括鼠标事件处理函数,用于捕捉用户的实时手写输入并绘制轨迹。通过GUI和M文件的交互,实现了简单的手写输入识别功能,适合初学者入门或作为手写识别项目的起点。
摘要由CSDN通过智能技术生成

41528d3028836879cd698677c3999917.gif基于matlab的手写输入板

Matlab 手写输入板 因为想做个手写数字识别,就先做了这手写输入的面板,这 是 我 根据 matlab 中文论坛里的一篇 文档写的。M 文件比较麻烦,删掉了些注释。 下面是 GUI 和 M 文件 M文件直接从控件开始吧% --- cutes on mouse press over figure background, over a disabled or % --- inactive control, or over an axes background. function figure1_WindowButtonDownFcn(hObject, eventdata, handles) global draw_enable %定义一个标志,1表示绘图,0表示停止绘图 global x; global y; global h1; draw_enable=1; if draw_enable==1p=get(gca, currentpoint ); %鼠标按下,获取当前坐标x(1)=p(1); y(1)=p(3); end% --- cutes on mouse motion over figure - except title and menu. function figure1_WindowButtonMotionFcn(hObject, eventdata, handles) global draw_enable; global x; global y; global h1; p=get(gca, currentpoint ); if draw_enable==1x(2)=p(1); %鼠标第一次移动后的坐标为x(2),y(2)y(2)=p(3); h1=line(x,y, EraseMode , xor , LineWidth ,5, color , b ); x(1)=x(2);y(1)=y(2); %鼠标移动时,随时更新折线的数据 end% --- cutes on mouse press over figure background, over a disabled or % --- inactive control, or over an axes background. function figure1_WindowButtonUpFcn(hObject, eventdata, handles) global draw_enable; draw_enable=0;% --- cutes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) axes(handles.axes1); cla; %清空,但cla是清楚坐标抽,故在下面又建立一个坐标轴,且取tag名为 axes1 axes( Position ,[19.8 12.923 70.2 15.462], tag , axes1 ); 效果图

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值