How can I track these fine particles?
조회 수: 4 (최근 30일)
이전 댓글 표시
답변 (2개)
DGM
2023년 9월 18일
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.
댓글 수: 0
Jerbin J
2023년 9월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!