Image analysis: separate objects in a 3D model using erosion
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello. I am trying to extract some objects from a binary image. The image is a 3D XCT scan. My first step is to threshold it to extract the objects of interest, which are the empty spaces. Some of them are connected with one another through narrow paths. For me those narrow paths should not be treated as objects. In other words, I need to separate the connected objects while erasing the paths which join them together. I know that this can likely be done by erosion but I am not sure how to implement it. The idea is that the objects would be separated in places where the distance from the "path" center to its "wall" becomes fairly low (e.g. the width of such a path is less than 5 px so the distance to the wall around 2-3 px).
Previously I tried to solve this by combining watershed and imextendmin and imimposemin (because the watershed algorithm tended to oversegment the image), but this approach seems very imprecise and the result varies significantly when changing the imexposemin value even by 1.
Here is the beginning of the code:
PART 1: extract the objects
clear; close all
% import the image
V1 = tiffreadVolume('./data/R9_big.tif');
% only show the objects which are not solids (voids) by choosing an approprite threshold level
TH = V1<135;
% filter the obtained 3D result so that the smallest objects (noise etc.) are deleted and change the format of the image
FI = medfilt3(TH);
FI2 = im2uint8(FI);
% binarize the image (I'll take a compliment of the image as I want the empty spaces to be zeros)
BI = imbinarize(FI2);
BI2 = ~BI;
% Use regionprops to compute Pixels IDs and Area
props = regionprops(BI2, 'Area','PixelIdxList');
[here I should somehow separate the objects using distance transform and erosion]
PART 2: analyse the outcome,
% find the volumes of individual objects; locate the objects in space and assign them with their volumes.
props = regionprops(M, 'Area','PixelIdxList');
vols = zeros(size(M));
for k = 1 : length(props)
y=props(k).PixelIdxList;
vols(y) = props(k).Area;
end
OUTPUT = (M+vols );
newColormap = hsv;
% display the result
volshow(OUTPUT,'Colormap',newColormap,'BackgroundColor',[0.3 0.3 0.3]);
___
This is a simple 2D illustration of the problem to be solved
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502244/image.jpeg)
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur 3-D Volumetric Image Processing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!