Edge detection in a crack pattern image
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-&gt;Type-&gt;32 bit
run("32-bit");
//Apply bandpass Filter:
//Manually by: Process-&gt;FFT-&gt;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.