# Crack width measurement on binary images

21 views (last 30 days)
Carlosgb86 on 13 Jun 2015
Answered: roni oz on 11 Jun 2021
I have a bunch of binary pictures showing different cracks with more or less complex geometries (see attached file). I would like to measure the crack width along the crack length (perpendicularly to the crack direction, not horizontally). When the crack branches into two or more thinner cracks I would like to measure the individual width of each crack (note that the crack edges are very irregular and the cracks are sometimes interrupted by small defects such as air bubbles).

Image Analyst on 13 Jun 2015
I would call bwdist() to get the distance transform.
edtImage = bwdist(binaryImage);
Then call
skelImage = bwmorph(binaryImage, 'skel', inf);
to get the skeleton. Then multiply those two together.
crackWidthImage = 2 * double(edtImage) .* double(skelImage);
This will give you the radius (half width) at each location, then multiply by 2 to get the full width. Now you have "the individual width of each crack" just as you asked for. Of course the width is different depending on where along the crack you decide to measure it.
Not sure what you want to do after this. You can inspect a certain point to find out the width there. Or you can take the histogram of the skeletonized distance transform if you want a distribution of crack widths over the entire image.
Image Analyst on 8 Jun 2021
@KAMOOSH BABA SHAIK, try my Image Segmentation Tutorial in my File Exchange. If you have a simple case of light cracks on a dark background or dark cracks on a bright background, you can easily modify it to use your own images.

Walter Roberson on 13 Jun 2015
Possibly :
imdilate() to connect across small breaks. Take the result and skeletonize it. Then from each "tip" of the skeleton, ask for the geodesic path back to a starting point. That path gives you implicit crack direction information.
But unfortunately the path is going to be pixelated, so at any one point you are going to want a bit of information about the previous and next pixel locations in order to determine your direction vector; the further back and further forward you look the more accurately you would be able to determine the slope of a long segment, but the more likelihood that you will encounter a curve in the path.
Supposing that you do create a function that can tell you the direction vector anywhere along the path, given the pixel list, to a satisfactory resolution. Then go back to the original image, and follow the path along it, take perpendicular to the direction, extend it in each direction until it hits the edge of the crack, total the length of the two sides, and that should be the width.
For direction vector (x,y) the perpendicular is (-y,x) or (y,-x)

Mohd Nasim on 6 Oct 2017
hello....i m doing project on crack detection in concrete, and i am unable to find crack width and length of crack in concrete...so...Plz send the matlab code for crack width and crack length for any surface.or provide me the source where i will get it...

roni oz on 11 Jun 2021
Hi
I'm doing work on this subject.
I would be happy if you could share the process for me too.
Thanks,
Roni