Abstract-Automated visual inspection (AVI) systems have been extended to many fields, such as agriculture and the food, plastic and textile industries. Generally, most visual systems only inspect product defects, and then analyze and grade them due to the lack of any sorting function. This main reason rests with the difficulty of using the image data in real time. However, it is increasingly important to either sort good products from bad or grade products into separate groups using AVI systems. This article describes the development of a mechatronic sorting system and its integration with a vision system for automatically removing contaminants from wool in real time. The integration is implemented by a personal computer, which continuously processes live images under the Windows 2000 operating system. The developed real-time sorting approach is also applicable to many other AVI systems.