So lately I am trying to work with indexes instead of for loops since it looks AND feels way faster on matlab.
So I am trying to change the following;
for i =1:size(l,1)
for j=1:size(l,2)
if l(i,j,1)>200 && l(i,j,2)<40 && l(i,j,3)<40
l(i,j,1)=144;
l(i,j,2)=0;
l(i,j,3)=0;
end
end
end
into this:
p1(:,:,1)= (200 < l(:, :,1) & 40 > l(:, :,2) & 40 > l(:, :,3)) ;
p2(:,:,2)= (200 < l(:, :,1) & 40 > l(:, :,2) & 40 > l(:, :,3));
p3(:,:,3)= (200 < l(:, :,1) & 40 > l(:, :,2) & 40 > l(:, :,3));
pix(p1(:,:,1))=144;
pix(p2(:,:,2))=0;
pix(p3(:,:,3))=0;
It is almost working and I can see the pictures , but the colors appear different on both pics. I mean that imshow(pix) doesn't look exactly the same as imshow(l). I really cant spot the problem.