## Diameter averaged mean intensity along the center-line of an image

### Bernard Ikhimwin (view profile)

on 5 Nov 2018 at 11:35
Latest activity Commented on by Bernard Ikhimwin

### Image Analyst (view profile)

My goal is to look for the diameter-averaged intensity of the attached image along the total center-line.
This is what I have in mind
1. I intend to look for the centre-line of an image using bwmorph operation (this I can do).
2. I intend to look for the branch points of the image, and subtract it from the center-line, to get discontinuous branches of the image (this I can do , using the morphological operations provided in Matlab).
3. Finally I intend to look for the index of the pixels that are perpendicular to each pixel of the centre-line of every branch; after getting the indices of these pixels I can then use it to mask the original image, and find the mean intensity, which will be mapped to each center-line pixel of the image. I intend to plot the mean intensity as a function of the center-line.
My difficulty is in (3), I do not know how to get the index of pixels perpendicular to the center-line. I will be happy if any one can let me know how to implement this. Thank you very much as I anticipate your response.

### Image Analyst (view profile)

on 5 Nov 2018 at 11:44

First get the skeleton with bwmorph(). Then get the distance transform with bwdist(). Then multiply those two images together. Then get the mean of all the non-zero elements. It should be like 3 or 4 lines of code.

Bernard Ikhimwin

### Bernard Ikhimwin (view profile)

There Image Analyst, I'm not sure if I understand what image you are referring to, but the binary image I am referring to was attached in my response to you named ('shearstressformathwork.png'). It is true that the original image was a screen shot of the simulation I did on the network. Find below the code I used to make it binary.
if true
% code file= '\Users\matlabshearstress2';
F2=im2bw(F1,0.0005);
F3=bwmorph(F2,'fill');
F3=bwmorph(F3,'fill');
%plot figure for binary image
figure(1)
image(255*F3);
colormap gray;
axis tight
axis equal
end
Image Analyst