Image segmentation for image processing
1 次查看(过去 30 天)
显示 更早的评论
I have a soil image to do analysis. I need to extract the size(diameter) of each soil particles from the image to determine the type of soil. I have done the segmentation using image filters but it seems like not working. It can't extract minute particles from the image. Please help! Thank you! Below is the sample image.
The below is the code I have used :-
rgbImage = imread('S01-15.tiff');
grayImage = rgb2gray(rgbImage);
se = strel('disk', 1,8);
filteredImage = imbothat(grayImage, se);
binaryImage = filteredImage > 1;
cc = bwconncomp(binaryImage,8);
n= cc.NumObjects;
Area = zeros(n,1);
Diameter = zeros(n,1);
MajorAxis = zeros(n,1);
Sand = zeros(n,1);
Silt = zeros(n,1);
Clay = zeros(n,1);
k = regionprops(cc,'Area','EquivDiameter','MajorAxisLength');
numClayParticles = 0;
numSiltParticles = 0;
numSandParticles = 0;
for m=1:n
Area(m) = k(m).Area;
Diameter(m) = k(m).EquivDiameter;
MajorAxis(m) = k(m).MajorAxisLength;
if Diameter(m) < 0.0236
Clay(m)=Diameter(m);
numClayParticles = numClayParticles + 1;
elseif Diameter(m) >=0.0236 && Diameter(m) < 0.5906
Silt(m)= Diameter(m);
numSiltParticles = numSiltParticles + 1;
elseif Diameter(m) >= 0.5906
Sand(m) = Diameter(m);
numSandParticles = numSandParticles + 1;
end
end
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!