Fractal cracking pattern characterization in heterogeneous materials under compression