In the production process of high-end PP-R pipes, mixing different colored raw material particles can result in uneven color in the final product, affecting its appearance quality. in addition, color mixing can reduce the physical properties of the pipes, impacting their durability and safety. To address this issue, we propose a visual, non-destructive inspection solution based on image processing technology. The solution aims to enhance detection efficiency and accuracy by reducing background interference and enabling adaptive adjustments in various environments. Initially, the K-Means image segmentation algorithm is employed to eliminate complex background factors from the original image, significantly improving image segmentation accuracy. Subsequently, the Gaussian mixture model algorithm is utilized to automatically extract the color threshold of the foreground image after background removal, facilitating adaptive algorithm adjustments. Finally, the mean value algorithm is introduced to swiftly and accurately identify plastic particles of different colors using the automatically obtained color thresholds. Experimental results demonstrate that this method can quickly and accurately identify different color particles and effectively support the rejection of impurity particles. Through this approach, the algorithm achieves an average detection accuracy of 99.3%.