フィルターのクリア

i have a capturing GUI, how do I save each image i capture in camera?

2 ビュー (過去 30 日間)
john john
john john 2012 年 1 月 17 日
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

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 17 日
Hi, John
Can you find opening fcn in your code?
Something like
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
In the openingfcn you should write
handles.output = hObject;
handles.index = 0;
guidata(hObject, handles);
And in your capsave_Callback you should write
function capsave_Callback(hObject, eventdata, handles)
handles.output = hObject;
handles.index = handles.index + 1;
set(handles.ss,'string','start');
load('pass_val_cam.mat', 'vid');
wa = getsnapshot(vid);
axes(handles.snap_shot);
imshow(wa);
newName = strcat('picture',num2str(handles.index),'.jpg');
imwrite(wa,['FINALS\' newName,]);
guidata(hObject, handles);

その他の回答 (3 件)

Walter Roberson
Walter Roberson 2012 年 1 月 17 日

john john
john john 2012 年 1 月 17 日
the image is not yet on the current folder... i already figure out imwrite to save the image but it keeps replacing the image everytime i click my capture image button...
what you think best solution for this?
  5 件のコメント
john john
john john 2012 年 1 月 17 日
Undefined function or variable "imgnum". <--- this is my error.. how do u define the imgnum? is it the file directory?
Walter Roberson
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
john john 2012 年 1 月 18 日
wow its perfect.. its fully working now..can i ask again sir? how do I insert the imresize function in matlab in order the image will be resize and it will be save in the folder..
which part of the code i am going 2 insert imresize?
  2 件のコメント
Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 18 日
before line
imwrite(wa,['FINALS\' newName,]);
just write :
wa = imresize(wa,scale);
'scale' is scalar.
john john
john john 2012 年 1 月 19 日
Thanks For the answer.. I already figure that out sir hehehe but what you give also is really working well.. =)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by