# How to measure the average thickness at the center region of binary image

8 Ansichten (letzte 30 Tage)
Timilehin Oyinloye am 21 Mär. 2023
Kommentiert: Timilehin Oyinloye am 22 Mär. 2023
I have a binary image that has various objects (white pixels) in various positions. I want to determine the average thickness of each white object in the binary image at its center (as shown in the third image with red letters). I appreciate your support.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Antoni Garcia-Herreros am 21 Mär. 2023
Hello Timilehin,
You can refer to this thread for more info, but this should do the trick.
lear all
close all
if length(size(I))>2
I=rgb2gray(I);
end
I=imbinarize(I);
I = imfill(I, 'holes');
BW2 = bwareaopen(I, 10); % Retain only large objects
r=regionprops(BW2,'Area','Centroid');
ApproxThick=zeros(size(r));
MeanCentralThick=ApproxThick;
Icopy=I;
for i=1:length(r) % Loop through all your objects
bwi = bwareafilt(Icopy, 1);
Icopy=logical(Icopy-bwi); % Subtract the objects from the image
ri=regionprops(bwi,'Area','Centroid');
BWSkel=bwskel(bwi);
ApproxThick(i)=ri.Area/sum(BWSkel(:)); % This would give you a good idea of the mean thickness of all the object
connec=bwconncomp(BWSkel);
[row,col] = ind2sub(connec.ImageSize,cell2mat(connec.PixelIdxList));
Mask=false(size(BWSkel)); % Mask of the skeletonize image containing only the central region
idxmin=floor(sum(BWSkel(:))*0.4); % Adjust these values to obtain the central region
idxmax=floor(sum(BWSkel(:))*0.6);
EuclImage = bwdist(~bwi); % Euclidean distance
MeanCentralThick(i)=2*mean(Thickness); % Average thickness of the central region
end
Hope this helps!
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Timilehin Oyinloye am 22 Mär. 2023
Thank you so much for your assistance. It was very useful.

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Image Analyst am 21 Mär. 2023
Basically you compute the Euclidean Distance transform and multiply it by the skeleton of the blobs.
See attached demo:
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Morphological Operations finden Sie in Help Center und File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by