Finding crack path using image processing

3 views (last 30 days)
waqas
waqas on 25 Jan 2021
Answered: Anmol Dhiman on 3 Feb 2021
I have previously asked a question of this forum (link to it) where I want to find the path of a crack using image processing. However, the same method is not working for my current implementation. Following the is the sample code (for the attached .mat file) that I am using:
Igray = mat2gray(V);
imshow(Igray)
th = multithresh(Igray,2);
Iseg = imquantize(Igray,th);
se = strel('disk',1);
BW1 = bwperim(Iseg == 1);
BW1 = imdilate(BW1,se);
BW2 = bwperim(Iseg == 2);
BW2 = imdilate(BW2,se);
BW3 = bwperim(Iseg == 3);
BW3 = imdilate(BW3,se);
imshow(BW1&BW2)
In another implementation, I get the results as shown in the figure below but they are not what I am looking for either. This figure is based on another method which is not robust.
How can make the code more robust to use the field in the mat file so that it would work for different cases?

Answers (1)

Anmol Dhiman
Anmol Dhiman on 3 Feb 2021
Hi Waqas,
The approach mentioned in the attached questions.seems robust enough and it should work for most of the cases.
There is no general approach for all images. It can happen that same approach might not give results for some images.
Try on multiple images to determine effectiveness of an approach.
Hope it helps

Community Treasure Hunt

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

Start Hunting!