Effacer les filtres
Effacer les filtres

How can I get correct output from bwlabel function?

2 vues (au cours des 30 derniers jours)
Alaa
Alaa le 28 Fév 2016
Commenté : Walter Roberson le 29 Fév 2016
Hi,
I've a problem with the output of bwlabel () function. I know exactly what is the input and the output of this function, but I don't know why does it give me incorrect output?
The problem is it takes all the cells in my image as one object. In other words, it gives NunOfobjs=1, which is really strange.
I have the following code:
binaryImage = (imread('12_SS.bmp'));% binary image of type logical
OriginalImage = imread('12.bmp');% original image (graysacle) of type uint8
% Label each nerve so we can make measurements of it
[labeledImage,NunOfobjs] = bwlabel(binaryImage, 8);
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
figure, imshow(labeledImage, []); title('Labeled Image, from bwlabel()');
figure, imagesc(coloredLabels);
The original image:
The binary image:
  2 commentaires
Alaa
Alaa le 28 Fév 2016
I've got the correct answer, I think it counts the white parts as connected components, of which there is only one. Try running bwlabel for the negative of my image (or ~binaryImage), to look for the now-black spots.
Walter Roberson
Walter Roberson le 29 Fév 2016
How did you calculate the binary image? It looks like perhaps you used edge detection, which is finding the boundaries between cells rather than finding the contents of the cells. Labeling the negation of your binary image would be a solution to that.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by