How to save multiple photos when taking from camera to a folder
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Diec Thuan
el 29 de Ag. de 2021
Comentada: Walter Roberson
el 29 de Ag. de 2021
Hi everyone, I want to ask for this code can only save 1 image in a folder, when taking a new photo, it replaces the previous image
Is there a way to save multiple images in a folder?
axes(handles.axes5);
vid= handles.vid;
capcha = getsnapshot(vid);
videoFrame=(capcha);
imshow(videoFrame);
imshow(capcha);
name = 'capcha.jpg';
full = fullfile('C:\Users\dieps\Desktop\BAI GIU XE\HINH ANH XE RA',name);
imwrite(capcha,full);
guidata(hObject,handles);
Thank for all
0 comentarios
Respuesta aceptada
Walter Roberson
el 29 de Ag. de 2021
Editada: Walter Roberson
el 29 de Ag. de 2021
num_to_take = 50;
imgdir = 'C:\Users\dieps\Desktop\BAI GIU XE\HINH ANH XE RA';
axes(handles.axes5);
vid = handles.vid;
for idx = 1 : num_to_take
capcha = getsnapshot(vid);
imshow(capcha);
drawnow();
full = fullfile(imgdir, sprintf('capcha_%04d.jpg', idx));
imwrite(capcha, full);
end
6 comentarios
Walter Roberson
el 29 de Ag. de 2021
num_to_take = 50;
imgdir = 'C:\Users\dieps\Desktop\BAI GIU XE\HINH ANH XE RA';
if ~isfolder(imgdir);
mkdir(imgdir);
end
axes(handles.axes5);
vid = handles.vid;
for idx = 1 : num_to_take
capcha = getsnapshot(vid);
imshow(capcha);
drawnow();
full = fullfile(imgdir, sprintf('capcha_%04d.jpg', idx));
imwrite(capcha, full);
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Preview and Device Configuration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!