# Edge detection in a crack pattern image

Here's an image of a cracked pattern. I wish to convert it to binary image where the continuous crack lines form the only discernible pixels. The main problems I am having in the lack of uniform lightning, which confuses threshold tools in image processing software, and the "black dots" which should be filtered out.

I am trying to use either Gimp, imagemagick or ImageJ to accomplish this, but have so far not been able to get to decent result.

I have a partial solution, without filtering the black spots.

These are my suggestions. They are pretty low tech, so feel free to play around with them. First get rid of the uneven illumination using a Bandpass Filter: These are the specific operations that I applied to your image recorded as a FIJI / ImageJ macro:

//convert to 32 bit image
//manually by: Image->Type->32 bit
run("32-bit");
//Apply bandpass Filter:
//Manually by: Process->FFT->Bandpass Filter...
run("Bandpass Filter...", "filter_large=75 filter_small=0 suppress=None tolerance=0");
//Enhance Contrast
run("Enhance Contrast", "saturated=0.35");


What that does is get rid of the slowly varying background in your image. Now you can manually adjust the threshold using Image->Adjust->Threshold. Press Apply after adjusting the threshold to your needs. This is what it looks like:

Again, this is all very low tech, but try to play around with this. Finally you might want to run Process->Binary->Skeletonize on the image.