Morphological Image Processing: Object Identification and Separation

33 Ansichten (letzte 30 Tage)
Moe Szyslak
Moe Szyslak am 19 Feb. 2026 um 20:20
Kommentiert: Moe Szyslak am 20 Feb. 2026 um 16:14
Hi, all --
As a graduate student I learned that the way to make image procesing easy was to start with good images. Sometimes, however, you have the images that you have, and that is where I am now (attached). It's not that the image is "bad" per se, it's that I am finding it difficult to do what I want with it.
What I would like: to transform the attached image (and many, many more like it) into a binary image containing only whole particles not in contact with one another.
Other information: particle orientation is unimportant and it is OK to delete any necessary particles to achieve the stated goal. (My working assumption -- for now -- is that over the span of many images these removals will average out.)
I have tried various combinations of binarization, erosion, dilation, etc., but I am pretty amateur at this. I am hoping someone with a bit of expertise could perhaps point me in the right direction.
Thanks in advance.
  2 Kommentare
Matt J
Matt J vor etwa 2 Stunden
Bearbeitet: Matt J vor etwa eine Stunde
I think there must be other criteria you've neglected to mention. As it is now, your criterion can be met just by binarizing one particle or two particles far apart from each other in the image. Is there no requirement on the density or coverage of the not-deleted particles?
Moe Szyslak
Moe Szyslak vor 42 Minuten
Excellent point -- thanks for the response. I suppose that the clarification would be that I would like to maximize the number of particles in the binarized image. That is, to remove the minimum number of particles necessary to achieve separation between the remaining particles.
Does that fully define the problem?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Image Analyst
Image Analyst vor etwa 2 Stunden
  3 Kommentare
Image Analyst
Image Analyst vor etwa eine Stunde
Sorry, no it doesn't make sense to me. Please describe precisely your definitions of isolate and separate and how they are different from each other.
You will not be able to get precise measurements for several reasons. One is that the particles overlap so if some of a particle is occluded by another particle, you won't have accurate silouhette of that particle since some of it will be missing. Secondly it depends on how the particles are laid down (what surface they lie on). If you drop the same particles down a second time, you'll get different area, perimeter, and feret diameter distributions. So you'll have to take many, many samples and even then you'll get distributions for partially occluded particles rather than particles as if they were all nicely separated. Nonetheless, that may be good enough to do whatever you eventually want to do with these measurements, like differentiate one batch of raw material from another batch.
Moe Szyslak
Moe Szyslak vor 16 Minuten
Thanks for the follow-up. Please see the image for an example of what I am calling "separated" versus "isolated". In separated, three particles are identified and delineated. In isolated, the middle particle is removed (or ignored) to provide a better view of the shape of the other two particles. My rationale is that the other two particles are slightly obscuring the full perimeter of the middle particle.
I 100% agree with you on the fact that, even when idolated, I will not get perfect shape descriptors of my particles for the reasons that you mention. I have to accept that because getting full 3D particle images (e.g., X-ray μCT) is extremely expensive relative to microscopy. I am comforted (slightly) by the facts that: (1) the minor axis of the particle is most likely the normal to the plan of the image, so I don't know zero about 3D shape; (2) we have observed empirically that bulk material behavior correlates well to 2D approximations of shape; and (3) previous studies have shown that certain 2D shapre descriptors are "reasonably good" predictors of certain 3D shape descriptors.
Thanks again -- I appreciate your insight.

Melden Sie sich an, um zu kommentieren.


Matt J
Matt J vor etwa 11 Stunden
Bearbeitet: Matt J vor etwa 11 Stunden
This might be along the lines of what you're looking for. It's semi-empirical though in the way it discards particles. Maximum density is not guaranteed.
load Image
contactDistance=20; %distance in pixels for blobs to be considered in contact
se=@(r) strel('disk',r);
I0=I;
I=imerode(I0,se(7));
%Initial blob identification
BW= imfill( imbinarize(I,"adaptive")|imbinarize(I),"holes");
BW=bwpropfilt(BW,I,'MaxIntensity',[50,inf]);
%Segment blobs using watershed method
BW=separateBlobs(BW);
D=interDists(BW); %Get adjacency matrix of blob separation distances
%Extract a "non-touching" subset of blobs
S = subsetExtract(D, contactDistance);
CC=bwconncomp(BW);
CC.NumObjects=numel(S);
CC.PixelIdxList=CC.PixelIdxList(S);
BW=cc2bw( CC );
imshow(labeloverlay(I0,BW));
function A=interDists(BW)
%Compute blob separation distances. Return adjacency matrix, A
arguments
BW logical
end
B={regionprops(bwmorph(BW,'remove'),'PixelList').PixelList};
N=numel(B);
A=zeros(N);
for i=1:N
A(i,i)=inf;
for j=i+1:N
A(i,j) = min(pdist2(B{i},B{j}),[],'all');
end
end
A=A+A';
end
function S=subsetExtract(D,d)
%Get a nontouching subset where "touching" is defined by
%threshold distance, d, and D is the separation distance adjacency matrix
while min(D(:))<d
idx=find(min(D,[],2)<d);
if isempty(idx), break;end
n=numel(idx); m=ceil(n/4);
cut=idx(randperm(n,m));
D(cut,:)=inf; D(:,cut)=inf;
end
S= find(~all(isinf(D),2));
end
function bw3=separateBlobs(bw)
%Watershed method for blob separation
D = -bwdist(~bw);
mask = imextendedmin(D,5);
D2 = imimposemin(D,mask);
Ld2 = watershed(D2);
bw3 = bw;
bw3(Ld2 == 0) = 0;
end
  1 Kommentar
Moe Szyslak
Moe Szyslak vor etwa 11 Stunden
Wow -- this is fantastic! The example you've provided looks to be right along the lines of what I am looking for. It will take me a little time to understand it, and then I want to test run it on a few more images.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by