Abstract
This paper introduces a robust and automated method for detecting grain boundaries and estimating particle sizes in microstructural images using OpenCV-based image processing techniques. The approach leverages high-resolution image analysis to enhance clarity and precision in boundary detection through a series of preprocessing steps, including image format conversion, cropping, brightness/contrast adjustments, and sharpening. Following this, Gaussian blurring and thresholding are applied to separate particles, with contour detection used to accurately identify grain boundaries. Particle sizes are then calculated by converting pixel dimensions to micrometers, enabling precise measurements. To improve the reliability of the results, statistical techniques like outlier removal and clustering are employed to refine the size distribution. Additionally, texture analysis is performed using the Gray Level Co-occurrence Matrix (GLCM), and k-means clustering is applied to segment regions based on texture similarity. This comprehensive method provides material scientists with a highly accurate, efficient tool for grain size analysis and boundary detection, offering significant improvements in both speed and precision compared to traditional manual techniques.