for loop over video data
Afficher commentaires plus anciens
Hi guys,
I want to extract data from a video, which is saved as a 4d Array. My plan is to use a for loop to extract data from the first 30x30 pixels of 50 frames and process these. After that I want to do the same with the next 30x30 pixels.
Right now I have this, but it is not working as I thought it would
for i = 1:50
for r = 1:29:size(data,2)
for c = 1:29:size(data,3)
if c+29 <= 960 && r+29 <= 540
red = mean(data(i,r:r+29,c:c+29,1),"all");
red(red==0) = [];
green = mean(data(i,r:r+29,c:c+29,2), 'all');
green(red==0) = [];
blue = mean(data(i,r:r+29,c:c+29,3), 'all');
blue(red==0) = [];
%%% Processing
end
end
end
end
Thank you in advance :)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!