A PE bottle detecting and sorting method based on machine vision comprises the following steps that firstly, PE bottle images are collected; secondly, the PE bottle images are subjected to pretreatment, wherein the collected images are subjected to image smoothing and sharpening treatment; thirdly, target positioning and recognizing are carried out, wherein a matching method based on an outline perimeter is used for matching and recognizing the PE bottle images, and a method based on a least squares fit ellipse is used for completing mass center position detection; fourthly, defects are detected, wherein a circle evenly-dividing method is adopted to complete PE bottle opening defect detection; fifthly, tracking grabbing is carried out, wherein according to the fed back position information, the positions of online PE bottles on a cartesian coordinate system are calculated, and online grabbing is completed; and sixthly, classification placement is carried out, wherein feature information of each PE bottle is sent to a mechanical arm control system, sorting is carried out through a mechanical arm, and the PE bottles are put in different regions. According to the method, the detecting and sorting efficiency is high, safety is good, and PE bottle defect detecting and sorting work is effectively achieved.