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
2019-5-23
Please correct me, If I misundestood the question.
You want to check wheather the both image are same or not (simmilarity)?
回答(0 个)
另请参阅
类别
在 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!