Extracting Cracks
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I am working on an image which has pores and cracks. I was able to extract the pores excluding the cracks. Now I have to extract only the cracks. Is there any way to do this, that is to extract only cracks.
Below are the two images - 1st is the original image and second is the image which has only pores.
Below is the link for the image which has cracks rounded with brown color.
6 Kommentare
Ashish Uthama
am 7 Nov. 2011
I can barely even see them at this resolution. What are these images? Can you improve the contrast/acquisition quality?
Akzeptierte Antwort
Sven
am 7 Nov. 2011
Hi Ratna, It's quite difficult due to the relative intensities - cracks are only a "little" bit lighter than solid material. Here's my solution, which utilises Dirk Kroon's Frangi Vessel Filter on the FEX.
Sorry, I'm in a rush so I don't have time to comment it, but it's relatively short - hopefully you can follow line-by-line.
I've needed to put some pretty specific thresholds. I have no idea how it will work with "similar but different" images.
I = imread('Original_crackes.jpg');
Im = rgb2gray(I(130:700,450:1000,:)); % Clear away the border
Im_limited = double(min(max(200,Im),255));
Im_closed = imclose(Im_limited, ones(8));
Im_diff = Im_closed - Im_limited;
BW_holes = imopen(Im_limited<205,ones(4));
BW_pores = imclearborder(BW_holes);
Im_diff(imdilate(BW_holes,ones(10))) = 0;
% Get vessels
[Im_edgeEnhanced,Scale,Direction] = FrangiFilter2D(Im_diff/max(Im_diff(:)),struct('BlackWhite',false));
BW_cracks = bwareaopen(Scale==2, 50) & ~imdilate(BW_holes,ones(10));
CC = bwconncomp(BW_cracks);
stats = regionprops(CC, Im_edgeEnhanced,'Eccentricity','MaxIntensity','Orientation')
keepMask = [stats.Eccentricity]>0.983;
BW_cracks(cat(1,CC.PixelIdxList{~keepMask})) = false;
% Display
figure
subplot(1,3,1), imagesc(Im_limited), axis image
subplot(1,3,2), imagesc(BW_pores), axis image
subplot(1,3,3), imagesc(BW_cracks), axis image
3 Kommentare
Walter Roberson
am 8 Nov. 2011
The rgb2gray() is not what is clearing the boarder: it is the array indexing. If your image is already in grayscale and already does not have the boarder, then change the series of lines to something like
[I, cmap] = imread('Original_crackes.IMA');
Im = rgb2gray(ind2rgb(I, cmap));
I am guessing here that IMA images are pseudo-color images.
Sven
am 9 Nov. 2011
Yes, the initial setup (loading the image, converting to grayscale, etc) is tailored to the sample .jpg file that you uploaded.
Since your true image is from from a different source, you will need to adjust those first lines as Walter points out.
Keep in mind that some of the constants that I've used: - Image limits of 200 -> 255 - "Hole" threshold of 205 - Various sizes for opening/closing/dilating (specified using "ones(x)") These were also tailored specifically to the image I had at hand. If your true image is different (ie, it actually uses CT Houndsfield units for intensity rather than the 1-255 that a .jpg conversion gives), then you may need to adjust those constants.
If in your original image the large circle is covered by approximately 512-by-512 pixels (which is the size of most full CT images), then this matches quite well with the image size that I wrote the answer for, and the dilation sizes I used should remain about right. You're still welcome to tinker with them to see if it improves the output.
Weitere Antworten (1)
Image Analyst
am 9 Nov. 2011
Another option worth trying is anisotropic diffusion http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/#anisodiff or coherence enhancing anisotropic diffusion filters, like is often used for fingerprints: http://www.vavlab.ee.boun.edu.tr/courses/574/materialx/PDEs%20in%20ImageProcessing/weickert_coherenceenhancing.pdf
Good luck.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Computer Vision with Simulink finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!