for loop over video data
Mostrar comentarios más antiguos
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 :)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!