Abstract:Mechanical compaction is one of the key factors leading to changes in soil structure and function, thereby constraining the sustainable development of agriculture.Three different types of soil, i.e. sand, loam and clay, were collected. Mechanical compaction was applied to simulate various compaction levels of soil samples, and the samples were subsequently scanned by using an advanced Skyscan 1275 Micro-CT system. The performance of three different algorithms—active contour (AC), marker based watershed (MBW) and K-means—on the segmentation of Micro-CT images of soil pores and aggregate structure was compared and the K-means image segmentation algorithm exhibited the best performance. Furthermore, the morphological watershed algorithm and Canny edge detection algorithm were used to effectively achieve the in-situ separation of individual soil aggregates and pores. Based on the K-means segmentation algorithm, a 3D in-situ visualization approach was established to quantitatively characterize the physical structure of soil using Micro-CT, enabling the visualization of pore and aggregate structures in different compacted soil samples. The Micro-CT imaging results were in excellent agreement with laboratory analyses. These findings can provide a rapid and environmentally friendly analytical tools for evaluating soil compaction and digitally mapping soil structure.