截图保存 matlab

file=dir('D:\Program Files\MATLAB\R2014a\bin\MyPro\OCR\图像中时间识别\')
for i=3:length(file)
path= strcat('D:\Program Files\MATLAB\R2014a\bin\MyPro\OCR\图像中时间识别\',file(i).name);
I=imread(path);
imshow(I);
[x,y,c]=ginput(2);
if c==1
BB=imcrop(I,[min(x(1),x(2)),min(y(1),y(2)),abs(x(2)-x(1)),abs(y(2)-y(1))]);
%axes(handles.axes2); %你的截图放在GUI中的axes2中
imshow(BB);
path= strcat('D:\Program Files\MATLAB\R2014a\bin\MyPro\OCR\pre_image\',file(i).name);
imwrite(BB,path);
end
end

posted on 2015-09-08 14:16  一动不动的葱头  阅读(330)  评论(0编辑  收藏  举报

导航