Saving a sequence of images
조회 수: 5 (최근 30일)
이전 댓글 표시
So further to my image processing:
I am reading a video file frame by frame. converting each frame to grayscale, zero'ing all values below 254 in the intensity matix, and then adding these images ontop of on another to build up a kind of time based image showing all the zones a particular event occured.
What I want to do now is save that resulting image after the addtion of each frame so that I end up with a folder full of images, the same number of images that made up the original film. Then I want to assemble them into a movie.
How do I save a sequence of images with a incrementing file name? i.e.
pic1.jpg pic2.jpg pic3.jpg .... pic(x).jpg
?
how do I append that incrementing count number, x, onto the end of the filename?
I tried this
imwrite(Sum,'C:\Documents and Settings\mmam16\My Documents\MATLAB\Pic#%d.jpg',x)
but I dont really know what the #%d does.
댓글 수: 0
채택된 답변
Ashish Uthama
2011년 5월 5일
Alex, you were close.
IMWRITE accepts a string name for the file, it does not know how to insert 'x' into the name. So you should create a string with the file name you want before passing it to IMWRITE:
filename = sprintf('c:\all that\Pic%d.jpg', x);
imwrite(data, filename);
You can also look at the doc for sprintf for various formatting options (like say zero padding the number).
댓글 수: 4
kousar majeed
2019년 6월 14일
i have to save the frame one by one
e.g. 1.1.jpg
1.2.jpg
1.3.jpg
how i can save the frame ... need help
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!