Finding crack path using image processing

4 次查看(过去 30 天)
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?

回答(1 个)

Anmol Dhiman
Anmol Dhiman 2021-2-3
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!

Translated by