enter image description here

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.


1 Answer 1


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
//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:

Image with edges visible

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.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.