How to differentiate between two attached images with 25 sand particles in each image. I have successfully calculated circularity of particles in images. Average value is similar for both samples. Please guide to how differentiate between two sands?

1 次查看(过去 30 天)
% The sand1 and sand2 images used are attached. In order to remove the noise in images median filter will variable rectangle window is used.
% for sand1 bw = medfilt2(bw, [30 30]);
% for sand2 bw = medfilt2(bw, [12 12]);
% rectangle threshold is fixed when the noise just disappears.
% An important to note is that with change in this window the circularity changes. How to deal with this ???????
clear all;
close all;
clc;
RGB = imread('sand1.jpg');
I = rgb2gray(RGB);
bw = imbinarize(I);
bw = bwareaopen(bw, 35);
se = strel('disk', 2);
bw = imclose(bw, se);
bw = imfill(bw, 'holes');
bw = medfilt2(bw, [12 12]);
[B, L] = bwboundaries(bw, 'noholes');
numberOfBoundaries = size(B, 1);
imshow(bw);
hold on;
for k = 1 : numberOfBoundaries
thisBoundary = B{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'R', 'LineWidth', 2);
hold on;
end
hold off;
stats = regionprops(L, 'Area');
for k = 1:length(B)
thisBoundary = B{k};
% computing perimeter
delta_sq = diff(thisBoundary).^2;
perimeter = sum(sqrt(sum(delta_sq,2)));
area = stats(k).Area;
% computing circularity
circularity(k) = 4*pi*area/perimeter^2;
end
  4 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2019-5-23
Please correct me, If I misundestood the question.
You want to check wheather the both image are same or not (simmilarity)?
Sumit Chaudhary
Sumit Chaudhary 2019-5-23
编辑:Sumit Chaudhary 2019-5-23
This two are sands from two different places having different physical and chemical property. Therefore, we are looking for parameters through image processing by which we can differentiate between these sands based on their shapes. In the above code, I have calculated circularity (shape parameters that gives how close are a shape is to a cirlce value and the value of circularity is 1 for perfect circle) but the average values is similair for these to sand.
Are we on the same page brother ?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by