'for loop' issue: computer becomes progressively slower as each loop is ran
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Arian Kolahi Sohrabi
am 4 Mär. 2019
Kommentiert: Arian Kolahi Sohrabi
am 4 Mär. 2019
Hello,
I'm running the following script:
video = input('type video name as string: \n')
v = VideoReader(video);
folder = 'X'
mkdir(folder);
l = v.NumberOfFrames
coordinates = zeros(2,l);
for img = 1:l-24;
filename = strcat('frame', num2str(img), '.jpg');
b = read(v, img);
imwrite(b,fullfile(folder, filename));
imshow(b);
hold on
[x,y] = ginput(1); %mark head and body
coordinates(1, img+1-1) = x(1,1);
coordinates(2, img+1-1) = y(1,1);
end
save('MFB50','coordinates')
After each loop is ran (after the coordinates of my mouse click are recorded), my computer becomes slower and slower. I'd appreciate it if anyone can help me figure out why this is happening.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Mär. 2019
You have hold on. All of those images are piling up on top of each other in the display.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!