How can i use parfor in my code?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I get an error saying "The variable rgb in a parfor cannot be classified." when i use "parfor" instead of for
here is my code
for m=1:size(rgb,1)
for n= 1:size(rgb,2)
for mm=1:size(t1rgb,1)
for nn= 1:size(t1rgb,2)
if abs(rgb(m,n,1)-t1rgb(mm,nn,1))<2 & abs(rgb(m,n,2)-t1rgb(mm,nn,2))<2 & abs(rgb(m,n,3)-t1rgb(mm,nn,3))<2
gray = .3*rgb(m,n,1)+.59*rgb(m,n,2)+.11*rgb(m,n,3);
rgb(m,n,:)= [gray gray gray];
end
end
end
end
end
1 Commento
Walter Roberson
il 2 Mar 2018
I really recommend that you vectorize your code.
Do I understand correctly that for each given pixel location, if the pixel is within (+/-2, +/-2, +/-2) for any pixel in t1rgb, that you want to replace the rgb pixel with a gray scale version of itself ?? If so then you could vectorize the test by using ismembertol() with an absolute tolerance configured.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!