HAOYANG MI
HAOYANG MI

Reputation: 151

Label segmented cells with different colors

I am working with Matlab to extract cells from pathology images. My codes successfully done the job and I can outline the cells by using 'bwperim'. To outline the cell, my codes are:

perim=bwperim(selected_img);
r=img(:,:,1);
g=img(:,:,2);
b=img(:,:,3);
r(perim)=255;
g(perim)=0;
b(perim)=0;
img(:,:,1)=r;
img(:,:,2)=g;
img(:,:,3)=b;

And labeled the cells are:

enter image description here

But now I want to make the whole cell labeled with red, rather than just outline, what should I do?

Upvotes: 0

Views: 79

Answers (1)

Shai
Shai

Reputation: 114846

It seems like you are looking for imfill:

mask = imfill(permi, 'holes');

Upvotes: 1

Related Questions