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 ); 效果图

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐