extracting area of cracks from image
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Elisa
el 19 de Jul. de 2024
Respondida: Deepak
el 19 de Jul. de 2024
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)
0 comentarios
Respuesta aceptada
Deepak
el 19 de Jul. de 2024
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 -
0 comentarios
Más respuestas (1)
Rahul
el 19 de Jul. de 2024
Hi @Elisa
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!
0 comentarios
Ver también
Categorías
Más información sobre Biomedical Imaging en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!