The detection of foreign substances in injection so far is still achieved artificially, which result in low accuracy and low efficiency. This paper focuses on developing a novel vision-based approach for detection of foreign substances. Foreign substances are classified into two categories, subsiding-slowly object and subsiding-fast object. A relative movement caused by a motor helps to distinguished foreign substances from ampoule surface scratches. Moving objects in injection are divided from static ones by a background image derived from two frames. The Mean Shift Embedded Particle Filter (MSEPF) is proposed to detect moving-slowly object while Frame Distance is defined to detect moving-fast object. 200 ampoule samples filled with injection are tested. The integrated detection accuracy with this approach is 98.00%, with 97.56% accuracy for subsiding-slowly objects and 96.67% accuracy for subsiding-fast ones. The result shows that the system can detect foreign substances effectively.