How can I extract the crack from the noise and human drawn grid lines?

12 Ansichten (letzte 30 Tage)
I am writing a program that is going to detect cracks from a concrete specimen image. The image has human-drawn grid lines by default, and these grid lines are going to curve because of a hydraulic press from above. After filtering the noise and grid lines, I plan to extract the cracks, create bounding boxes, and then draw the skeleton in the middle of the crack contour. Following this, I will measure the crack width and length using an edge pixel searching process. Here is my code so far.
%convert to grayscale
gs = im2gray(img);
%adjust the histogram
gsAdj = imadjust(gs);
%apply gaussian blur
filterSize = 5;
sigma = 1; % standard deviation of the Gaussian kernel
G = fspecial('gaussian', filterSize, sigma);
I_blur = imfilter(gs, G, 'same'); % apply the filter
BW2 = edge(I_blur,'canny');
imshow(BW2)
imwrite(BW2,"bw_canny.jpg")
I am new to image processing, I am looking for ways to filter out noise and grid lines from my images. I am particularly interested in techniques that can help me identify grid markings in a binary image and change their pixel values from 1 to 0. Any advice on this would be greatly appreciated.

Akzeptierte Antwort

Image Analyst
Image Analyst am 16 Jun. 2025
What I would do is to first get rid of the grid lines, then analyze what's left for cracks. To determine the grid line location I would use drawline to manually locate the horizontal lines between the rows of tiles. Then do it again for the vertical grid lines. If the vertical gridlines are perfectly equally spaced, and you know how many tiles there are, you can just draw the leftmost and rightmost one and then locate the others by interpolation. Then use false and linspace to create a binary image (mask) with the location of the grid lines set to true. Then use imdilate to thicken the lines a little bit. Now use that mask with grid lines in it along with regionfill to in-paint the grid lines in the original image. Now you should have an image with only cracks in it and no grid lines between the tiles. Then it gets a bit tricky because some of your cracks are light on a dark background and others are dark on a light background. You might have to find each type individually and combine the two detections afterwards.
For finding cracks or ridges you might look at ridge finding algorithms, like a Hessian Filter, Frangi filter, or COSFIRE filter. There are some in the File Exchange. Look at algorithms used in ophthalmology or angiography because those types of images usually have crack-like features on backgrounds of varying intensity. Here are some links that may help:
In addition, you can search the Image Processing literature for relevant terms:

Weitere Antworten (1)

Mathieu NOE
Mathieu NOE am 16 Jun. 2025
Verschoben: Matt J am 16 Jun. 2025

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by