i have a capturing GUI, how do I save each image i capture in camera?
古いコメントを表示
this is the function button of capsave which get a snapshot of the camera then save the image.. how do i save the image every time I captured?
function capsave_Callback(hObject, eventdata, handles)
% hObject handle to capsave (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.ss,'string','start');
load('pass_val_cam.mat', 'vid');
wa = getsnapshot(vid);
axes(handles.snap_shot);
imshow(wa);
newName = sprintf('.jpg');
imwrite(wa,['FINALS\' newName,]);
%disp(image_val);
% pause(ntrvl);
clc;
a
採用された回答
その他の回答 (3 件)
Walter Roberson
2012 年 1 月 17 日
0 投票
john john
2012 年 1 月 17 日
0 投票
5 件のコメント
Walter Roberson
2012 年 1 月 17 日
Use the techniques shown in the link above to dynamically construct the file name to write to.
john john
2012 年 1 月 17 日
Walter Roberson
2012 年 1 月 17 日
Near the top of your callback:
persistent imgnum
In the part of your callback where you construct newName:
imgnum = imgnum + 1;
newName = sprintf('snapshot%04d.jpg');
This will save in files named beginning with "snapshot" followed by a 4 digit number (with leading zeros), with ".jpg" extension.
john john
2012 年 1 月 17 日
Walter Roberson
2012 年 1 月 17 日
The
persistent imgnum
defines imgnum.
There is a small bug in what I wrote, though: after the "persistent" command, add
if isempty(imgnum); imgnum = 0; end
(This is not a fix to imgnum not being defined; that is the job of the "persistent" that needs to be in your callback.)
john john
2012 年 1 月 18 日
0 投票
2 件のコメント
Chandra Kurniawan
2012 年 1 月 18 日
before line
imwrite(wa,['FINALS\' newName,]);
just write :
wa = imresize(wa,scale);
'scale' is scalar.
john john
2012 年 1 月 19 日
カテゴリ
ヘルプ センター および File Exchange で Image Preview and Device Configuration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!