For improving the efficiency, flexibility and robustness of yarn defect system, a new method is proposed to evaluate the quality of yarn by testing the yarn diameter, defects and hairiness based on machine vision and image processing technology. Firstly, the diameter image processing unit (DIPU) is defined and a series of sampling points are selected from moving yarn, and the DIPU corresponding to each sampling point is segmented from the captured yarn images. The average diameter of DIPU is used to represent the yarn diameter of the test points. In the extraction of yarn images, the DIPU is divided into definite foreground region, definite background region and unknown region according to the characteristics of gray-level projection distribution, and the unknown region is further processed with Poisson matting method, in which the yarn image and background image are completely separated by a defined connectivity classifier. After the yarn core is extracted by the classifier, the hairiness is divided by using image subtraction. Finally, in order to further evaluate the quality of yarn, the yarn defects were analyzed by the method of statistical methods. INDEX TERMS Yarn quality evaluation, diameter image processing unit (DIPU), Poisson matting, connectivity classifier, hairiness extraction, yarn defects statistics.