Image processing and analysis techniques are commonly utilized in various fields such as geology, underwater engineering, environmental conservation, marine resource exploration, and soil and geological assessments, particularly for examining drilling rock samples. However, processing images of rocks drilled underwater is challenging due to the intricate nature of aquatic settings, where factors such as light reflection and refraction, irregular sizes of rocks, and overlapping particles introduce noise, obscure textures, and distort colors in the images. Although improved versions of the mask region-based convolutional neural network have shown promise for quick and accurate analysis of large sets of underwater rock images, these methods can still be affected by inconsistencies in rock appearance, texture, and lighting. To address these issues, a comprehensive approach is introduced using the segment anything model. Our methodology begins with the application of Gaussian filters to reduce noise and smooth images, followed by the deployment of underwater image enhancement. Further, histogram equalization is applied to better the contrast and employ the segment anything model approach for the detailed understanding of rock features by extracting information on rock size and shape. EeEquivalent area circle diameter and axial ratio are used to generate particle size alignment maps and to ascertain shape details. Our approach has achieved an average precision rate of 80.6%, outperforming other strategies and yielding more precise rock information analysis.