Separating overlapping edges in an image to get an accurate count
Mostrar comentarios más antiguos
Hi,
I am trying to count the big cells in the sample image below.

I was able to reach a point where I was able to delete most of the smaller cells and highlight the big cells as seen below.

However, when I count the objects (using bwlabel and bweuler) it's giving me 6. It is probably because of the overlapping edges of the objects on the leftmost side?
How can I separate these overlaps so I can get an accurate count of 7?
Thank you!
Respuesta aceptada
Más respuestas (1)
DGM
el 3 de Mayo de 2021
This works, but I had trouble trying to get watershed() to work without a little tweaking.
inpict = im2double(imread('cells.jpg'));
% try to extract the more bluish purple part
tol = [0.15 0.2]; % box width
clim = 0.615+[-1 1]*tol(1); % selected color point in C,H
hlim = 0.863+[-1 1]*tol(2);
cmap = mono(inpict,'clch');
hmap = mono(inpict,'hlch');
interior = cmap>clim(1) & cmap<clim(2) & hmap>hlim(1) & hmap<hlim(2);
% this is similar to bwareaopen(), but it does opening and/or closing
interior = despeckle(interior,20);
d = bwdist(~interior);
d(d<(max(d(:))/2)) = 0; % had to give watershed a little help
L = watershed(~d);
L(~interior) = 0; % this is the label array
max(L) % this is the number of labeled objects
imshow2(simnorm(L))

This uses MIMT tools just because I'm lazy and can't be bothered to do it all in base/IPT tools
2 comentarios
Arturo Jr. Ongkeko
el 4 de Mayo de 2021
DGM
el 4 de Mayo de 2021
Well it's not like MIMT is a thing anyone should be taught. It's good you solved it though.
Categorías
Más información sobre Blue en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!