Sunday, April 9, 2017

label2rgb in MATLAB: code and output

Code:

I = imread('rice.png');
subplot(1,2,1);
imshow(I);
title('original image');

BW = im2bw(I, graythresh(I));
CC = bwconncomp(BW);
L = labelmatrix(CC);

RGB = label2rgb(L);
subplot(1,2,2);
imshow(RGB);

title('RGB image'); 

Output:


No comments:

Post a Comment