How to find the position of the objects after using bwlabel?

3 次查看(过去 30 天)
So, I want to identify the type of cells. If the cell is green and blue, it has to be categorized as type A. And if the cell is Red and blue it has to be categorized as Type B. I was able to separate these cells as R, G, and B. But I don't know how should I proceed? For example, in this picture, I got two cells in R and six cells in B, but I want to find a way so that if R and B both are present in the detected object then it is Type B cell. This is what I have done for identifying the blue objects.
Thank you in advance.
b=img(:,:,3)-mean(mean(img(:,:,3)));
b=b>100;
b= bwareaopen(b, 100);
[labeledImage_b, numberOfObject_b] = bwlabel(b); %finding the number of blue objects
Image source: Vortex Biosciences

回答(1 个)

Walter Roberson
Walter Roberson 2019-4-23
You can call regionprops() on labeled images to get information about things like bounding box.
However, if you are not planning to use the label information afterwards, it is more efficient to just pass teh binary image to regionprops() instead of labeling and passing the label image.
You can construct several binary images and AND them together to locate regions that have multiple color components.

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by