Save multiple images in a folder

After I captured the image it save the image.But when I captured again another image and when I save it, the previous image replaced by the new image. I want to save new image not to replace it. How will I do that?

Antworten (2)

Massimo Zanetti
Massimo Zanetti am 4 Okt. 2016

3 Stimmen

Change its name

1 Kommentar

Muhammad Hammad Malik
Muhammad Hammad Malik am 20 Aug. 2018
without changing the name how can we save different images with out overwrite?

Melden Sie sich an, um zu kommentieren.

Thorsten
Thorsten am 4 Okt. 2016

0 Stimmen

You have to use a new name for each image; e.g., for your i'th image:
filename = sprintf('myimage%02d.png', i);

4 Kommentare

Hazel Sialongo
Hazel Sialongo am 4 Okt. 2016
I want to use for loop but I don't know how because I want to save images from webcam 10 times.
Thorsten
Thorsten am 4 Okt. 2016
Bearbeitet: Thorsten am 4 Okt. 2016
for i = 1:10
I = ... % get image I from webcam
filename = sprintf('myimage%02d.png', i);
imwrite(filename, I)
end
Hazel Sialongo
Hazel Sialongo am 4 Okt. 2016
How to get image from webcam? I'm sorry i'm new to this.
Muhammad Anwaar
Muhammad Anwaar am 31 Jan. 2019
by this u can take image through webcam and u can save it
webcam = webcam(1);
preview(webcam);
img = snapshot(webcam);
imshow(img);
imwrite(img, 'ab.png');

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 4 Okt. 2016

Kommentiert:

am 31 Jan. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by