I want to vectorize the array : final
I made this code to make red the pixels of the array I
bw : black and white array
I : the original image
final : the array i want to store the values
for i = 1:sz1
for j = 1:sz2
if (bw(i,j)==1)
final(i,j,1)=255;
final(i,j,2)=0;
final(i,j,3)=0;
else
final(i,j,1)=I(i,j,1);
final(i,j,2)=I(i,j,2);
final(i,j,3)=I(i,j,3);
end
end
end
I don't want to have any for/loops. Have anyone an idea? Thanks
答案 0 :(得分:0)
谢谢!解决了:
final=I;
final(bw==1)=255;