image acquisition and imaqmontage

1 回表示 (過去 30 日間)
Rafael Madrid
Rafael Madrid 2014 年 9 月 8 日
コメント済み: Image Analyst 2014 年 9 月 8 日
Hi,
I've captured a number of frames using the image acquisition toolbox and exported them to the workplace, and want to save all of them as individual bmps. I can load all of them with imaqmontage, then save them individually with for example;
>> imaqmontage(hemi_0);
>> img = hemi_0(:,:,:,9);
>> imwrite(img,'imagename.bmp');
but that is a hassle since I will have several images. Help save them all automatically?
Raf

採用された回答

Image Analyst
Image Analyst 2014 年 9 月 8 日
Put in a loop and call getsnapshot() instead of imaqmontage().
snappedImage = getsnapshot(videoObject);
After each call to getsnapshot, call imwrite() with a different name.
  3 件のコメント
Rafael Madrid
Rafael Madrid 2014 年 9 月 8 日
Say if I only use
imwrite(4-Duint8array(:,:,:,1), 'im01.bmp', 'bmp');
How can I repeat this with the names increasing in number without having to type them all in?
Raf
Image Analyst
Image Analyst 2014 年 9 月 8 日
If you have a 4D array of 3D color video frames, use a loop
for f = 1 : size(4-Duint8array, 4)
thisFrame = 4-Duint8array(:,:,:,f);
baseFileName = sprintf('frame #%d.bmp', f);
fullFileName = fullfile(folder, baseFileName);
imwrite(thisFrame, fullFileName);
end

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by