In industrial field, various automation techniques have been studied and applied to increase productivity, better accuracy and eliminate the human errors. This paper developed a model of the automatic defect sorting system to distinguish between qualified and defective products. By using image processing to detect the matching of captured images with the storage based sample, the system ensures products with different colours are correctly delivered to the designated box. In this study the detection of three types of products were tested by image processing provided by LabVIEW software. They are the cube face with full of red panels, the cube face with 3 of 4 red panels and the others. The test results of the system achieved approximately an accuracy of 96% under stable lighting conditions.