Effacer les filtres
Effacer les filtres

extracting area of cracks from image

39 vues (au cours des 30 derniers jours)
Elisa
Elisa le 19 Juil 2024 à 8:19
Réponse apportée : Deepak le 19 Juil 2024 à 11:28
Dear all, I wrote this code to extract cracks from a tomography image. I tried many ways to remove the background and enhance the colors for better crack extraction, but some cracks are still missing. Can anyone help me improve the code?
clear all
close all
clc
A= imread('image_1567.png');
[rows, columns, numberOfColorChannels] = size(A);
[centers,radii] = imfindcircles(A,[500 650],Sensitivity=0.95);
mask = circles2mask(centers,radii,size(A));
new_image = A;
new_image(~mask) = nan;
figure(1)
sigma = 20;
Iflatfield = imflatfield(new_image,sigma);
imshow(Iflatfield)
figure(2)
imhist(Iflatfield);
figure(3)
crackMask = Iflatfield < 50;
imshow(crackMask)

Réponse acceptée

Deepak
Deepak le 19 Juil 2024 à 11:28
Hi,
As I can understand you are trying to extract cracks from a tomography image. You tried several ways to enhance the colours of image, but some some cracks are still missing.
For better crack extraction from the image, you can perform following changes in your code –
1. Enhance contrast using adaptive histogram equalization
A = adapthisteq(A);
2. Apply Gaussian smoothing to reduce noise
A = imgaussfilt(A, 2);
3. Set the threshold value to 52 for better results
Here is the updated code snippet –
clear all
close all
clc
A= imread('image_1567.png');
A = adapthisteq(A);
A = imgaussfilt(A, 2);
[rows, columns, numberOfColorChannels] = size(A);
[centers,radii] = imfindcircles(A,[500 650],Sensitivity=0.95);
mask = circles2mask(centers,radii,size(A));
new_image = A;
new_image(~mask) = nan;
figure(1)
sigma = 20;
Iflatfield = imflatfield(new_image,sigma);
imshow(Iflatfield)
figure(2)
imhist(Iflatfield);
figure(3)
crackMask = Iflatfield < 52;
imshow(crackMask)
Attaching the documentation of above used functions for reference -

Plus de réponses (1)

Rahul
Rahul le 19 Juil 2024 à 11:01
In addition to your provided code to extract areas including cracks from the given image, you can make use of image processing techniques like Adaptive Histogram Equalization and Median Filtering to enhance the contrast of the image to better identify the crack areas.
You can do this by using 'adapthisteq' and 'medfilt2' functions respectively.
You can refer to this link to know more about their functionalities:
You might also consider tweaking the threshold value that you have defined as 50. This can help you get your desired result.
Hope this helps!

Catégories

En savoir plus sur Biomedical Imaging dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by