How can I track these fine particles?

5 Ansichten (letzte 30 Tage)
Raju
Raju am 18 Sep. 2023
Beantwortet: DGM am 18 Sep. 2023
Hello,
Is it possible to track these fine particles (black dots in the attached image) using their centroids?

Antworten (2)

DGM
DGM am 18 Sep. 2023
Here's one idea. I'm sure there are better ways. It really depends which specks are necessary. With the limited depth of field, it seems a lot of the specks are barely visible.
% fetch the image
inpict = imread('image.jpeg');
inpict = im2gray(inpict);
inpict = rot90(inpict,1); % so that it fits better on the forum display
% find the undesired features
bgmask = ~imbinarize(inpict,'adaptive','foregroundpolarity','dark','sensitivity',0.36);
bgmask = imfill(bgmask,'holes');
bgmask = bwareaopen(bgmask,25);
imshow(bgmask,'border','tight')
% flatten and normalize
fpict = imbothat(inpict,strel('disk',3));
fpict = mat2gray(fpict);
imshow(fpict,'border','tight')
% binarize
pmask = fpict > 0.35;
pmask = pmask & ~bgmask;
imshow(pmask,'border','tight')
% do the rest
S = regionprops(pmask,'centroid');
C = vertcat(S.Centroid);
imshow(inpict,'border','tight'); hold on
plot(C(:,1),C(:,2),'rx','markersize',10);
Is that all of the specks? No. Are there things selected which are not specks? Probably. You'll have to play around with it.
Ultimately, these objects are only a few pixels in diameter. They are tiny, low-contrast features in a noisy image that has a bunch of JPG compression artifacts all over it. Many of the specks are barely distinguishable from noise. It's going to be difficult to get everything reliably.

Jerbin J
Jerbin J am 18 Sep. 2023
Hi Raju,
Is this what you are looking for?
% Read the image
image = imread('imageTest.jpeg');
% Preprocess the image
gray_image = rgb2gray(image);
bw_image = imbinarize(gray_image, 'adaptive', 'ForegroundPolarity', 'dark', 'Sensitivity', 0.4);
% Measure properties of connected components (particles)
stats = regionprops(bw_image, 'Centroid');
centroids = cat(1, stats.Centroid);
% Display the original image with centroids
imshow(image);
hold on;
plot(centroids(:, 1), centroids(:, 2), 'r*', 'MarkerSize', 10);
hold off;
% If required save centroids to CSV file
csvwrite('centroids.csv', centroids);
  1 Kommentar
DGM
DGM am 18 Sep. 2023
I'm pretty sure OP is trying to get the small (~3px) specks

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by