How to distinguish different color cells in the image?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
larry liu
il 23 Giu 2021
Commentato: Image Analyst
il 23 Giu 2021
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 Commenti
Risposta accettata
Image Analyst
il 23 Giu 2021
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 Commenti
Image Analyst
il 23 Giu 2021
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);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Segmentation and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!