Particle recognition from image with regionprops
Afficher commentaires plus anciens
Hi,
I'm trying to write a script for automated particle recognition and subsequent size analysis from SEM images (scanning electron microscopy). I tried to adapt a published script ("A simple algorithm for measuring particle size distributions on an uneven background from TEM images", Gontard et al., 2011) to my needs:
% Selecting an image
[file,ruta]=uigetfile({'*.tif';'*.bmp'},'Select a SEM image');
cd(ruta);
fc_1 = imread(file(:,:,1));
fc_2 = imcomplement(fc_1);
fc = imcrop(fc_2,[1 1 1024 600]);
imshow(fc);
% Selecting subimages
[N,M] = size(fc);
ns=input('Number of divisions = '); min_nm=input('Minimum size (nm) = ');
mag = input('Magnification (x) = ');
scale = mag^(-1.002)*936937; % nm per pixel
min_px = round(min_nm / scale);
x = fix(N/ns);
y = fix(M/ns);
for sx=1:x:N-x
for sy=1:y:M-y
sp=fc(sx:sx+x-1,sy:sy+y-1);
% Thresholding
T = graythresh(sp);
spT = im2bw(sp,T);
g(sx:sx+x-1,sy:sy+y-1)=spT;
end
end
g2 = imopen(imcomplement(g),strel('disk',min_px));
[labeled,a]=bwlabel(g2,4);
points = regionprops(labeled,'Centroid','PixelList');
[B,L2,N2] = bwboundaries(labeled,4,'noholes');
% Draw segmented particles
imshow(fc);
hold on
for s=1:numel(points)
boundary = B{s};
if(s > a)
plot(boundary(:,2), boundary(:,1), 'g','LineWidth',1);
else
plot(boundary(:,2), boundary(:,1), 'r','LineWidth',1);
end
end
hold off
% Histogram
graindata = regionprops(labeled,'basic');
areap = [graindata.Area];
t=0;
for s=1:numel(points)
t = t + 1;
sizes_px(t) = 2*sqrt(areap(s)/pi);
end
figure;
nm = mag^(-1.002)*936937;
sizes_nm = nm*sizes_px;
hist(sizes_nm,30);
Mean=mean(sizes_nm), Standard_deviation=std(sizes_nm)
However, it's not working as expected yet. To give you an idea of how the pictures might look like, here's an example:

Now my problem is, that some particles are not at all recognized. In other cases, two particles that overlap are considered as one big (next pictures shows the results from the script).

I know that this is a complex task, but it might already be helpful to set an area limit, like the opposit of the minimum area. But I don't know if that's possible. Any ideas?
Thanks so much!
Réponses (2)
Image Analyst
le 2 Jan 2014
1 vote
I'd try imfindcircle() and see how that does. You could also experiment with imtophat() and imbottomhat().
Also, you should read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Sergey
le 2 Jan 2014
1 vote
I'd recommend you imtophat/imbothat to make background more regular and than marker-guided watershed (combination of imregionalmax, imimposemin and watershed: you impose minima the background detected according to gray level, I usually choose <0.5*graythresh(), and regional maxima on complementary - objects are darker - images, and then perform the watershed). The approach worked for pollen TEM images.
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!