Saving images to different files using imwrite()

i have a set of images which i have to write to an external file, for which i am using the imwrite().I am using the imwrite() inside the for loop. How do i write these images to different files ??

답변 (2개)

Image Analyst
Image Analyst 2013년 5월 17일

1 개 추천

You can use a for loop if there is any way that your "set of images" variables can be specified by an index - for example they're all in individual cells of a cell array or are movie frames that you extract from the movie. See the FAQ for several code examples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
If they're just a bunch of individually and arbitrarily named variables, like image1, grayImage, originalImage, and rgbImage, then you'd be best off just calling imwrite() once for each image variable.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 17일

0 개 추천

for k=1:10
filename=sprintf('file%d',k)
imwrtie(filename,IM)
end

댓글 수: 3

Rida
Rida 2014년 10월 30일
hello,I was just trying t do the same, (saving multiple images) in a loop, I followed your answer, it says the following error: ??? Undefined function or method 'imwrtie' for input arguments of type 'uint8'. can you please help?
Stephen23
Stephen23 2014년 10월 30일
There was a spelling mistake in the original answer. Try changing the function to imwrite.
Mitali G
Mitali G 2016년 3월 1일
It should be imwrite(IM,filename)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2013년 5월 17일

댓글:

2016년 3월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by