Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Could anybody tell me how to replace these loops with either parfor or vectorization as the code right now runs extremely slowly?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
[rows, columns, numberOfColorChannels] = size(face); % face is an image matrix
for x=1:rows
for y=1:columns
if(red(x,y)>=150)
n = n+1;
rtot = sum(double(red(:)));
end
end
end
rmean= rtot/n;
for x=1:rows
for y=1:columns
red_pixel= red(x,y);
if(red_pixel>=200)
if(red_pixel> rmean)
blush= blush+1;
rblush = sum(double(red_pixel(:)));
end
end
end
end
perc_blush(i)= (blush/(rows*columns))*100;
perc_pale(i)= ((abs(rblush-rmean))/(rows*columns))*100;
6 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!