Info

この質問は閉じられています。 編集または回答するには再度開いてください。

matlab gui

5 ビュー (過去 30 日間)
ammara AMMARA
ammara AMMARA 2012 年 5 月 30 日
回答済み: Voss 2021 年 12 月 31 日
i am acquiring live video data from the webcam. i capture the images and want to save those images in some other file. but when i save an image, the previously saved image is being replaced by the newly saved image. whereas i want to save all the images which i capture. my code goes like this:
[filename,pathname]=uiputfile('*.*','Save file as'); if(filename~=0) vidobj1=handles.vidobj; snapshot = getsnapshot(vidobj1); snapshot=imresize(snapshot, [256, 256]); imwrite(snapshot,'.JPG'); end
can anyone tell me what modifications i will have to make to this code such that the images are not overwritten.

回答 (1 件)

Voss
Voss 2021 年 12 月 31 日
You'd have to tell imwrite() to write to the file just selected:
[filename,pathname]=uiputfile('*.*','Save file as');
if(filename~=0)
vidobj1=handles.vidobj;
snapshot = getsnapshot(vidobj1);
snapshot=imresize(snapshot, [256, 256]);
% imwrite(snapshot,'.JPG');
imwrite(snapshot,fullfile(pathname,filename),'jpg');
end

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by