How can I count the black particles without counting the small particles in the background?
Ältere Kommentare anzeigen
I want to automatically measure the particle size and number, but I can't because of the out-of-round shape and the contrast with the background.
rgb_im = imread('bild_1.jpg');
gray_im = adapthisteq(rgb2gray(rgb_im));
% bw_im = imbinarize(gray_im,'adaptive','ForegroundPolarity','dark','Sensitivity',1);
bw_im2 = ~imbinarize(gray_im,'adaptive','ForegroundPolarity','bright','Sensitivity',1);
bw_im4 = imdilate(bw_im2,strel('disk',1));
BW1 = imfill(bw_im2,'holes');
BW2=255-BW1;
figure, imshow(BW2)
imshowpair(BW1,BW2,'montage')

I have inverted the image and now I want to remove the small black dots from the background. However, I can't get that to work.

Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!