Hi,
In this example below the labeled objects are shown using the jet colormap, on a gray background, with region boundaries outlined in red.
Therefore, how can I change the background to white and label each object with different color?
%based on http://www.mathworks.es/es/help/images/ref/bwboundaries.html
I = imread('rice.png');BW = im2bw(I, graythresh(I));[B,L] = bwboundaries(BW,'noholes');imshow(label2rgb(L, @jet, [.5 .5 .5]))hold onfor k = 1:length(B) boundary = B{k}; plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2)end
Cheers and thanks.
Best Answer