Text this: An Improved Algorithm in Porosity Characteristics Analysis for Rock and Soil Aggregate