Which mask can I use to count particles in an image?
5 次查看(过去 30 天)
显示 更早的评论
Hello, I have this image and I want to count particles in it. I have binarized the image with the code reported below and now I have to count particles. It was told me that I have to find a mask that compare white particles to an objet (maybe a circle) of established dimensions and if the object is contained in the white particles than I can consider it a particle, if is not I go on. What can I use?
clear all
close all
clc
I=imread('dapi_cd105-FGF.jpg');
I2=I(:,:,3);
BW=imbinarize(I2);
采纳的回答
Image Analyst
2019-11-24
There are a number of measures you can do to compare it to a circle, such as the aspect ratio (ask for BoundingBox), Solidity, and circularity (ask for Area and perimeter);
props = regionprops(mask, 'Area', 'Perimeter', 'Solidity', 'BoundingBox');
allAreas = [props.Area];
allPerim = [props.Perimeter];
circularities = allPerim .^2 ./ (4 * pi * allAreas);
bb = vertcat(props.BoundingBox);
aspectRatios = bb(:, 3) ./ bb(:, 4);
Aspect ratios, solidities, and circularities should all be around 1 or so. Anything more than about 2 or 3 is not very circular.
2 个评论
Image Analyst
2019-11-25
If all you needed was a count of the blobs in the binary image, you could use bwlabel():
[labeledImage, numberOfBlobs] = bwlabel(binaryImage);
but that's on the original image, not the number that you'd have after you post process to extract only round blobs.
更多回答(2 个)
KALYAN ACHARJYA
2019-11-24
编辑:KALYAN ACHARJYA
2019-11-24
Steps:
- Convert to binary image with adjustable threshold value
- Counts the blobs in binary image, here blobs represents the particles in the image
As first step you have already done, for second step here is the code
blobs_data=regionprops(binary_image);
num_blobs=numel(blobs_data);
Or
From your code
I=imread('dapi_cd105-FGF.jpg');
I2=I(:,:,3);
BW=imbinarize(I2);
blobs_data=regionprops(BW);
num_blobs=numel(blobs_data)
0 个评论
Anna Demetriou
2024-4-29
hello, how can i count microparticles from an image in 2 different places and compare them in a graph?
1 个评论
Image Analyst
2024-4-29
Make a mask up for each ROI, then call regionprops on it. AND the roi mask with the particle mask to get a segmentation of just the particles within the ROI.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!