How to find the position of the objects after using bwlabel?
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 23 Apr 2019
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.
0 Comments
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!