How to distinguish different color cells in the image?
1 次查看(过去 30 天)
显示 更早的评论
I have an image with two different color cells like below shows
and I need to claasify it and count how much cells like below shows red and yellow
how can I do that?
I have tried edge detection but it seems doesnt work.
0 个评论
采纳的回答
Image Analyst
2021-6-23
They don't look very different to me. I'd try the Color Thresholder on the Apps tab of the tool ribbon. Try HSV and RGB color spaces and see if you can get differentiation.
2 个评论
Image Analyst
2021-6-23
You can first get rid of the grid with imclearborder(). That might get rid of some blobs that are connected to it though. If you don't want to lose them, then don't use a grid.
Then you can find round particles by looking at their circularity.
mask = imclearborder(mask); % Get rid of grid and blobs touching it.
mask = imfill(mask, 'holes');
props = regionprops(mask, 'BoundingBox', 'Area', 'Perimeter');
bb = vertcat(props.BoundingBox);
widths = bb(:, 3);
heights = bb(:, 4);
aspectRatios = widths ./ heights;
allAreas = [props.Area];
allPerimeters = [props.Perimeter];
circularities = allPerimeters .^ 2 ./ (4 * pi * allAreas);
% Get indexes of blobs where aspect ratio is less than about 3 and
% circularities less than about 5. Adjsut as needed.
keeperIndexes = (circularities < 5) & ...
(aspectRatios < 3) & ...
(1./aspectRatios < 3)
[labeledImage, numInitialBlobs] = bwlabel(mask);
fprintf('Before shape filtering, found %d blobs.\n', numInitialBlobs);
mask = ismember(labeledImage, find(keeperIndexes));
imshow(mask);
% Remeasure with the filtered set of blobs.
props = regionprops(mask, 'BoundingBox', 'Area', 'Perimeter');
numFinalBlobs = length(props);
fprintf('After filtering, found %d blobs.\n', numFinalBlobs);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!