How can i use parfor in my code?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Walter Roberson
el 2 de Mzo. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Deep Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!