An Automatic Image Technique for Rock Stability Analysis