Want to find the coordinates of the particles from an image

9 views (last 30 days)
I want to find the cordinates of the non spherical particles from an image to estimate the local structure from an image. The image attached for the reference. I have been trying to do this but the overlapped particles creates the problem. Please help me with this problem. Thanks in advanve.
  2 Comments
Walter Roberson
Walter Roberson on 30 Jul 2022
Have you experimented with finding the dividing lines so that you can mask out the round particles, instead of having to take the properties of all particles in the image and ignore the ones with low eccentricities (that is, the round ones)?
AASHNA SUNEJA
AASHNA SUNEJA on 30 Jul 2022
Edited: AASHNA SUNEJA on 30 Jul 2022
Thank yu for the reply Walter
I dont get what exactly you are trying to say. I am new to MATLAB so doesn't have much knowledge in this. Could you please suggest soe code for the same. And the area of intrest is only the non spherical particles. I dont need to consider the spherical particles in the image. Basically I want to estmate the Kernel Density.

Sign in to comment.

Answers (2)

Ayush
Ayush on 25 Oct 2023
Hey Aashna,
I understand that you want to find the co-ordinates of the non spherical particles from an image to estimate the local structure from an image and you are facing issues with the overlapping particles.
So, to estimate the coordinates of non-spherical particles in an image and ignore the spherical particles, you can try the following approach:
  1. Convert the image to grayscale if it is not already in grayscale.
  2. Apply a thresholding technique to segment the particles from the background. This will create a binary image where the particles are white and the background is black. You can experiment with different thresholding methods such as global thresholding, adaptive thresholding, or Otsu's thresholding.
  3. Use morphological operations like erosion and dilation to remove noise and refine the particle shapes. This can help separate the overlapping particles to some extent.
  4. Use the regionprops function in MATLAB to extract the properties of the connected components in the binary image. Specifically, you can extract the eccentricity of each particle. The eccentricity value ranges from 0 (perfect circle) to 1 (line-like shape). Filter out the particles with low eccentricities (e.g., below a certain threshold) to exclude the spherical particles.
  5. Once you have the filtered particles, you can estimate their coordinates using the centroid property provided by the regionprops function.
Here is an example code snippet that demonstrates the steps mentioned above:
% Read the image
image = imread('DSC_0029.jpg');
% Convert to grayscale
grayImage = rgb2gray(image);
% Apply thresholding
threshold = graythresh(grayImage);
binaryImage = imbinarize(grayImage, threshold);
% Perform morphological operations
se = strel('disk', 3);
binaryImage = imopen(binaryImage, se);
% Extract properties of connected components
props = regionprops(binaryImage, 'Centroid', 'Eccentricity');
% Filter out spherical particles
eccentricityThreshold = 0.8;
nonSphericalParticles = props([props.Eccentricity] > eccentricityThreshold);
% Extract coordinates of non-spherical particles
coordinates = cat(1, nonSphericalParticles.Centroid);
% Display the results
imshow(image);
hold on;
scatter(coordinates(:, 1), coordinates(:, 2), 'r', 'filled');
hold off;
You can adjust the parameters and thresholds as per your specific requirements.
Once you have the coordinates of the non-spherical particles, you can proceed with estimating the Kernel Density using the "ksdensity" function in MATLAB.
Hope the above information helps!

Image Analyst
Image Analyst on 25 Oct 2023
Have you tried imfindcircles in the Image Processing Toolbox?

Community Treasure Hunt

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

Start Hunting!