The invention discloses a needle sorting machine based on machine vision, which comprises a main body of the sorting machine and a computer operating system. Among them, the right side of the surface of the main body of the sorting machine is provided with a control panel, and the control panel is embedded with the main body of the sorting machine. The machine vision detection system uses lighting to convert the detected target into an image signal through the detection device, and transmits it to a dedicated computer operating system through the image acquisition system, and converts it into a digital signal according to pixel distribution, brightness, color and other information. The image acquisition system Perform various operations on these signals to extract the characteristics of the target, such as area, quantity, location, and length, and then output the results according to the preset tolerance and other conditions, including size, angle, number, qualified or unqualified, with or No, etc., to realize the automatic identification function.