Only saving one iteration of the for loop is being saved to the file, but I need all the iterations to be saved to the file.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The code works well, however, only one iteration of my for loop is being saved into the tiff file. When I open the .tiff there are only 30 images. I am not sure if this error is because the for loop is overwriting the first 30 images every time it iterates, or if the way that I am saving my images, that when they save, the first thirty are being written over by the second iteration. Possibly I am using the wrong trigger event?
Below is my code
vid = videoinput('hamamatsu', 1, 'MONO16_BIN4x4_512x512_FastMode');
src = getselectedsource(vid);
%vid.FramesPerTrigger = 10;
% TriggerRepeat is zero based and is always one
% less than the number of triggers.
%vid.TriggerRepeat = 2;
src.ExposureTime = .3;
%when I want to take multiple images, wait awhile and then takee more
%images in the same file.
for i = 1:2
tic
vid.FramesPerTrigger = 30;
fprintf(obj, 'O 0 1'); %on
preview(vid);
%fprintf(obj, 'O 0 1'); %on
start(vid),wait(vid);
toc
for l = 1:2
fprintf(obj, 'O 0 0'); %off
pause (10);
end;
end;
stoppreview(vid);
stop(vid);
alpha = input('What do you want to name you file? ','s');
x = getdata(vid);
filename = [alpha '.tif'];
for slnum = i : size(x, 4)
if slnum == i; mode = 'overwrite'; else mode = 'append'; end
imwrite( x(:,:,slnum), filename, 'writemode', mode);
end
closepreview(vid);
delete(vid);
clear vid;
3 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Hamamatsu Hardware dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!