The invention discloses an 
image processing-based bottled liquid 
impurity detection 
system and a detection method thereof. The detection 
system consists of a mechanical part and a 
machine vision part; the mechanical part comprises a step motor, a conveyer belt, a fixed 
pulley and a mechanical clamping device; the 
machine vision part comprises a 
camera obscura, a related internal structure, a FPGA (
Field Programmable Gate Array) board, a 
serial communication port, a display module, an alarm module and upper 
computer software. The detection method of the 
system is as follows: an image is acquired; the image is segmented from the background by the seed fill 
algorithm; salt and pepper noises and interference pixels are filtered by fuzzy 
processing; contrast is increased by binarization 
processing; the image is connected completely by 
erosion and dilation operation to remove tiny 
noise, so that impurities become visible; finally, 
contour tracing and extraction are carried out to obtain the number, shapes and positions of the impurities. The invention increases 
image acquisition and 
processing speed, consequently, manual detection can be replaced, and the purpose of increasing detection speed, quality and production benefit is achieved.